Questions tagged [refit]

Refit is a library heavily inspired by Square's Retrofit library, and it turns your REST API into a live interface.

Refit is a .NET library heavily inspired by Square's Retrofit library (JAVA), and it turns your REST API into a live interface. Read more on refit at Github.

204 questions
2
votes
0 answers

Using Refit in Core/Android/IOS I encountered System.NotImplementedException error

System.NotImplementedException: You've somehow included the PCL version of Refit in your app. You need to use the platform-specific version! Currently using MVVMCross framework referenced the Core Project I have tried this in multiple…
2
votes
1 answer

How to create a generic Unauthorized IHttpActionResult from Not a Controller

I have an API call which returns IHttpActionResult using Refit. [Patch("/api/userprofile/")] [Headers("Authorization: Bearer")] Task UpdateUserProfile(UserProfile user); I created a separate class in a separate DLL to handle…
Mike
  • 5,918
  • 9
  • 57
  • 94
2
votes
0 answers

Refit / HttpClient / ModernHttpClient - 400 Bad Request

Recently started with ReactiveUI and so far so good. While trying to figure out stuff I came across a HttpClient / Refit problem. I have a long list and every item in that list have to make a request to a API as follows. This is a…
2
votes
3 answers

How should I serialize JSON from Refit in an F# project?

I'm using Refit in a C# project to create an API client. I'd prefer to do everything with F# but Refit doesn't fully support F# yet. If I create my User model in C# everything is fine but I'd prefer to be able to express which properties are…
Paul Young
  • 1,489
  • 1
  • 15
  • 34
1
vote
1 answer

How to use Polly with Refit?

I am not configuring my Refit client using the services in Startup. I am doing the following: public Task GetService() { var retryPolicy = HttpPolicyExtensions .HandleTransientHttpError() …
Ivan Debono
  • 457
  • 3
  • 14
1
vote
1 answer

Cannot find AddRefitClient method for Worker Service

Currently I using .NET version 7 to do background job service. I add Worker Service project, in Program.cs file I cannot call method AddRefitClient although I add package Refit to call API. I don't want to use HttpClient This is error…
Truc
  • 386
  • 4
  • 12
1
vote
2 answers

Polly policy handle Refit ApiException with DI AddPolicyHandler

I set up the following service collection with a Refit client and a Polly policy for dependency injection in my UWP app: var serviceCollection = new ServiceCollection(); serviceCollection .AddRefitClient(typeof(IClassevivaAPI)) …
Gabboxl
  • 91
  • 3
  • 16
1
vote
0 answers

Refit with querystring array parameter

I am using Refit as my rest client but i am facing a problem with this rest api, which has a array of complex objects inside a QueryString parameter. public async Task GetHierarchy([FromQuery] SearchParameter[]?…
1
vote
2 answers

Why is Refit serializing URL parameter boolean values using capital letters?

I have an ASP .NET 6 Rest service in which I have a pretty basic Refit API interface defined for a GET operation with a request object that has several properties on it. Here's the request definition: [Get("/users")] Task
Lordshmee
  • 43
  • 3
1
vote
2 answers

Reusing a Polly retrial policy for multiple Refit endpoints without explicitly managing the HttpClient

I am trying to make Refit work with Polly in an ASP.NET Core 6 application. I have a working version, but I feel that there is too much code involved for each new method / consumed API endpoint. I want to keep things simple for now by defining a…
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
1
vote
0 answers

RestSharp ParameterType.RequestBody to Refit

Is there a way to convert a RestSharp implementation that includes something like this: request.AddParameter("application/json; charset=utf-8", body, ParameterType.RequestBody); to a Refit implementation? I have no solutions atm.
1
vote
1 answer

How to serialize DateOnly using refit.?

I'm searching for this since 3-4 days I've almost got the answer but still I can't implement in my code. Actually I never understand or can't work by seeing the documentation. :/ And I need another suggestion as well I'm using date only because I…
1
vote
2 answers

Xamarin Refit type initializer for System.Text.Json.JsonSerializer threw an exception

I am using Refit 6.1.15 in a Xamarin forms project. My code works exactly as expected on Android, but on iOS, I get a "The type initializer for 'System.Text.Json.JsonSerializer' threw an exception." when I execute my api. I am using…
1
vote
1 answer

Passing value between Refit Proxy and DelegatingHandler

I am using Refit to define my HttpProxy method. I also got a custom Delegating handling a bearer token request that it inserts before the request is being sent through. In order to generate a token, I need an ID. I am sending this ID by using…
codebased
  • 6,945
  • 9
  • 50
  • 84
1
vote
0 answers

Refit exception system.Text.Json.JsonReaderException: 'M' is an invalid start of a value

I am using Refit version 6.0.94. I have a .net 5.0 Api and a Blazor Server app .Net 5.0. The Api and Web app are both deployed in Linux containers. When running locally in visual studio (windows 10) I do not get the error. The Get and Delete verbs…
BankMan101
  • 109
  • 9