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
0
votes
0 answers

Refit Api exception an error occured deserializing the response system.text.json xamarin forms

i am trying to get a user data from api but it always shows me an error that refit exception cant deserialize this is the json [ { "_id": "6342110f32eca716e8c79165", "name": "Ak", "password": "a", "gmail": "a@gmail.com", "__v":…
0
votes
1 answer

Refit - ApiResponse wrapping in a methods cannot get access to content

I am using refit and works great but I am also new to it. I have the need to wrap up ApiResponse in a call (see below) because within this method I will do things like Logging Handling exceptions etc.. but I cannot make it work as its…
developer9969
  • 4,628
  • 6
  • 40
  • 88
0
votes
0 answers

HttpGet or HttpPost when paginating or filtering many parameters webapi2

I am working an a legacy ASP.NET webApi 2 (.net 461) and I have added refit to make make life easier. Now There lots of calls where we are fetching data (GET) but we have many parameters as request. Basically something like below is a typical…
developer9969
  • 4,628
  • 6
  • 40
  • 88
0
votes
1 answer

How to use BSON with Refit client

I am trying to use a Refit client against a method in a ASP.NET 6 controller that returns Bson. The method looks like this: [Produces("application/bson", Type=typeof(MyDto))] public async Task GetBinaryDataAsBson(Guid id) In the…
0
votes
1 answer

refit: keep original exception from api

I used a middleware to handle exceptions from the api, like this: app.UseMiddleware() In the middleware, I customed the api response like this: Use refit, I want to keep the original exception from api, instead of the…
Minh Giang
  • 631
  • 9
  • 28
0
votes
1 answer

Unable to access API using Refit. Receiving "Response status code does not indicate success: 405 (Method Not Allowed)."

I am working on a .NET API at the moment and I am trying to write NUnit tests, using Refit to connect to my API. When I try to access my API with Refit, I keep receiving an HTTP error code 405, indicating that the method I am trying to access is…
0
votes
1 answer

Using an ILogger in a Polly Policy attached to a Refit Client

I've been trying to follow the directions from this blog post to pass an ILogger to my retry policy in order to log information about the errors being retried. The code in the blog doesn't work out of the box as we're using Refit for client…
Bob Kinney
  • 8,870
  • 1
  • 27
  • 35
0
votes
1 answer

Refit's Default behavior for object in post method without [body]

I am reading Refit's https://github.com/reactiveui/refit#body-content document and understand what Body attribute when used for the 4 possibilities. My question is for the example in above document, what is the behavior if I take the Body attribute…
0
votes
1 answer

Refit variable on [Get("{route}")]

I'm having trouble with Refit using variables as path for a Get request This is my super simple Get request public interface IParceriaIntegracao { [Get("/{caminho}")] Task GetShow(string caminho); } This is my…
0
votes
0 answers

How to handle Multi-Status 207 Http Response in Refit

I'm trying to handle Multi-Status 207 response from one of API. I have created interface like: public interface IServiceAPIs { [Post("/api/data/generate")] Task GenerateData([Body]generateDataRequest) } and I'm receiving 200 OK as well as 207…
0
votes
0 answers

How to post a URL encoded dictionary within a strongly typed object from Refit

I am trying to replicate a URL Encoded Form Data request that contains a dictionary from Postman into Refit but I cannot get it (Refit) to produce the same encoded data. See the comparisons below and notice that the encoded data from Refit has…
Steve Wilford
  • 8,894
  • 5
  • 42
  • 66
0
votes
1 answer

Why is Refit with custom handlers converting my GET requests into POST requests? (405 Method Not Allowed)

I have a Xamarin app in which I am using Refit to call my ASP.NET Core Web API backend (.NET 6). On the iOS side of things, I use a custom System.Net.Http.HttpClientHandler to add the api key and bearer token to the requests. On Android, I do…
NovaJoe
  • 4,595
  • 6
  • 29
  • 43
0
votes
0 answers

Refit REST library - Unable to post List in Body

I'm unable to post List through refit. Here's the interface declaration: [Post("/api/Url/{id}")] [Headers("Content-Type:application/json")] Task PostMethod([Body(BodySerializationMethod.UrlEncoded)] CommandType command) Here's the…
Shahriar
  • 1
  • 2
0
votes
1 answer

Making OData call using Refit

I have an OData query as below. http://localhost:65202/api/odata/StaffBookings?$select=ID&$filter=Staff/ID eq 1&$expand=Staff($select=ID),Event($select=ID,EventDate;$expand=Client($select=ID,Company)) How can I call it using Refit? Thanks Regards
Y U
  • 65
  • 5
0
votes
1 answer

API returning an object instead of string

I have an API that I set calls with refit, however when calling it I'm receiving an object instead of a string, I don't get what the issue is here. var userToken = await apiClient.LoginuserBySsnAsync(ssn); the definition of the API call: …
Baldie47
  • 1,148
  • 5
  • 16
  • 45