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
1 answer

Call API WEB with Refit from Webforms Page .Net Frameworks

I can use Refit from a WebForms Page, to connect with a rest web api method. Some example? This is my code and I get the following error: protected async void btnAcceder_Click(object sender, EventArgs e) { var api =…
0
votes
0 answers

base64 encoded file upload via json api endpoint encountering Status code 400

I'm trying to send a PDF file that is converted to Base64 to an API endpoint but I'm encountering a Status Code 400 which is Bad Request error. First, I'm converting my PDF to base64 format then send it to an API endpoint by using Refit Post. My PDF…
error404
  • 13
  • 7
0
votes
0 answers

Xamarin .NET API using Refit error Refit.ApiException

I face an error from refit. In development, i run API on local IIS and no issue. When i put on IIS server i got a Refit.ApiException: Response status code does not indicate success: 500 (Internal Server Error).…
0
votes
2 answers

AddRefitClient DryIoc and IServiceProvider on Prism for Xamarin.Forms

I am trying to follow DryIoc and IServiceProvider on Prism for Xamarin.Forms (DryIoc.Microsoft.DependencyInjection) however I am using RefitClient for IHttpClientFactory containerRegistry.RegisterServices(services => { …
j.t.h.
  • 121
  • 1
  • 11
0
votes
0 answers

Refit Xamarin Newtonsoft.Json.JsonReaderException expecting JSON receiving HTML instead Newtonsoft.Json.JsonReaderException

I am receiving an error when calling an API and it returns HTML(error occured) instead of JSON which causes the Xamarin app to crash. I realize this is not ideal for the API to return this, but what I am working…
j.t.h.
  • 121
  • 1
  • 11
0
votes
0 answers

Refit me showing an error when initializing

I am trying to consume a service using Refit and I have the following problem. I was looking at the documentation but I can't find a solution and I don't know if I should do anything else. This is my model public partial class Global { …
0
votes
0 answers

Xamarin Adding Semi-Const Headers to Refit API Call

[Updated] Thanks to jason in the comments I was able to find the solution. You can supply a new httpClient when creating the rest service which will take a client handler. In the client handler overwrite the SendAsync method and add the request…
Ubarjohade
  • 471
  • 6
  • 21
0
votes
1 answer

Error: Newtonsoft.Json.JsonSerializationException

Hello, I am learning to use Refit and I have a problem. these are the models public partial class Source { [JsonProperty("id")] public string Id { get; set; } [JsonProperty("name")] public string Name { get; set;…
0
votes
0 answers

CancellationToken Source does not return taskcancelled when token.cancel is called

Below is the Service method that i call.... after i have called the service... my net goes off and i cancel the token Which means after i have hit the service i cancel the token... is there a way to cancel the service i have called... below is my…
0
votes
0 answers

How to show listview with refit in xamarin form

I try show listview in xamarin form with data json from web service It is my data json: {"isSuccess":true,"resultMessage":"","data":[{"password":"MnwPzyBdAZBrDV6xMHoIzg","userid":4,"name":"Budi","tanggal_lahir":"09/03/1996…
Ryan
  • 1
  • 2
0
votes
0 answers

Requests start to fail in Xamarin using Refit

After making a lot of network requests in a short space of time, we keep getting "A task was canceled" error from our responses, once we start getting these errors any requests made after the errors stop return the same errors too until we restart…
MichaelStoddart
  • 5,571
  • 4
  • 27
  • 49
0
votes
1 answer

Refit - How to have OPTIONAL dynamic headers

I am using Refit and would like to set OPTIONAL dynamic headers for some methods. For example if the user is logged in, I want to have header "UserId" and "AuthenticationToken", otherwise do NOT set the headers [Post("/search")] Task
Kevin Hu
  • 80
  • 1
  • 11
0
votes
0 answers

System.Threading.Tasks.TaskCanceledException: 'The operation was canceled.' and it takes too long for my byte[] to send

here is how i get the byte array and the type of array and how i send the object public partial class Addprofilepicture : ContentPage { ImageButton imagebutton; Label basse64; IMyAPI myAPI; APIRequestHelper…
0
votes
2 answers

How to authenticate Prestashop API REST Client

I created an interface to call the Prestashop API using Refit, for a Bot App I'm developing. In order to call the API you need to authenticate with a Prestashop API Key, which I have. To query using the browser I only need to call an url with this…
0
votes
0 answers

How to call a rest API using refit in a xamarin library/sdk

I'm building a xamarin library/plugin and the plugin is supposed to call an API using refit but when I call the API I get the following error: System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException:…
Atuma
  • 33
  • 1
  • 1
  • 7