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
1
vote
0 answers

How to pass serialized parameter to query in Refit

I try to send GET request to API, I need to create url like test.com/api.php?apitoken=1111&event_name=buy_year&event_data={"ubtcuid":"ckerggrggsg1ini","event_datetime":"2021-07-02 15:36:40","client_id":"123456"} My C#…
Tzarek
  • 13
  • 4
1
vote
1 answer

NullReferenceException when testing API implemented by Refit

I'm trying to test some error responses (BadRequest, Unauthorized, ...) with Refit and so I implemented a TestHandler that returns any desired response. The response works fine with an "OK" (HTTP status code 200) response: public class Program { …
RobIII
  • 8,488
  • 2
  • 43
  • 93
1
vote
1 answer

Where to handle getting new access token with refresh token using Refit and Xamarin Forms

I am currently using Refit and have been handling my auth stuff in an AuthenticationService where I set my Refit settings to have AuthorizationHeaderValueGetter use my AuthenticationService.GetAuthenticationToken() to get my access_token. The logic…
jmichas
  • 1,139
  • 1
  • 10
  • 21
1
vote
1 answer

What do i need to do after making an api call using refit

I'm learning a little more about Restful in C# .NET but I'm having some problems when I call an API. I had done a similar project before and it worked, but using the same template for this specific API is no longer working. The idea is to consult an…
user15270486
1
vote
1 answer

Generating the CSharp refit Clients from the Repo

I am trying to generate the Refit Api Clients from the Git Project : https://github.com/itofinity/swagger-csharp-refit I have installed Maven and created Project. But The only issue that I am facing is that. [main] INFO…
Kishan Bheemajiyani
  • 3,429
  • 5
  • 34
  • 68
1
vote
2 answers

C# Refit - Is there any converter for creating C# Interface and model from Swagger document

I'm creating automatic type-safe REST API (Refit) from Swagger document. I'm Creating Interface and model class manually like below. Is there any tool to to generate like this? Swagger file: "paths": { "/configuration/v1/devices/{device_serial}": { …
1
vote
0 answers

Refit 6, net 5 error Cannot determine the frame size or a corrupted frame was received

I found the following similar SO answer that didn't fix my issue. I have a 5.0 console app and the HttpClient is being configured manually instead of using the Refit extension factory method (both ways result in the error). Console app config,…
Will Lopez
  • 2,089
  • 3
  • 40
  • 64
1
vote
1 answer

Refit v6.x 'utf8' is not a supported encoding name

Refit 6 makes System.Text.Json the default JSON serializer, After I upgraded to v6.x, an exception occurred: Refit.ApiException: An error occured deserializing the response. ---> System.InvalidOperationException: The character set provided in…
HeroWong
  • 499
  • 1
  • 5
  • 14
1
vote
0 answers

HeaderCollection attribute in Refit is not recognized

In a UWP application, I am using Refit REST library. I need my request header to be dynamic. For that I am following below approach: [Get("/users/{user}")] Task GetUser(string user, [HeaderCollection] IDictionary
tahiat
  • 116
  • 8
1
vote
0 answers

Upload IFormFile using Refit in .Net Core 3.1

I am using Refit current stable version in .Net Core 3.1 application and want to call an API from MVC application with IFormFile property in request model. I have added Multipart attribute at endpoint declaration. I don't want to replace IFormFile…
Vinod
  • 31
  • 1
1
vote
1 answer

Refit HttpClient not adding DelegatingHandler

I'm trying to set a HttpMessageHandler for a refit client which adds the Authorization Header to the request, but it's not working after I followed the documentation and multiple github examples. Here is how I configure it: …
Radu Olteanu
  • 393
  • 4
  • 17
1
vote
1 answer

Refit: versioned routes

We were using Refit on one of your API's to create and share a Client package for that API. ICategoryApi.cs [Post("/category")] Task CreateCategoryAsync([Body] CategoryCommandDto createCategoryCommandDto); and everything was working fine with a…
Pablo Recalde
  • 3,334
  • 1
  • 22
  • 47
1
vote
0 answers

Refit API HTTPPost 'Unexpected character encountered while parsing value' from .net Core 3.0 Console app

I have an api endpoint as follows [HttpPost("create")] [MapToApiVersion("1.0")] public async Task Post(CarDto carDto) { return Ok(await _carService.CreateCarAsync(carDto)); } The Dto below is a shared do…
MicroMan
  • 1,988
  • 4
  • 32
  • 58
1
vote
1 answer

Refit upload file from Api to Api

I am trying to upload an image from one Asp net core backend to an other via refit. await _repository.UploadImageAsync(userId, new StreamPart(file.OpenReadStream(), file.FileName, file.ContentType), extension); The…
DirtyNative
  • 2,553
  • 2
  • 33
  • 58
1
vote
0 answers

HttpRequestException when call Api in xamarin

In xamarin, I call the api using the refit library. I have followed the instructions, but when calling the exception api was returned. I don't know if my combination of prism will affect? I have called a manual api but it also doesn't work I also…
hungnt03
  • 61
  • 5