Questions tagged [restsharp]

RestSharp is a simple to use REST client library for .NET

RestSharp takes the pain out of calling REST services from .NET. This library takes care of the quirks in .NET's HTTP classes, handles deserialization cleanly, simplifies making asynchronous calls, and just makes it really easy to implement calls to REST services from inside your application.

RestSharp comes with a built-in JSON serializer. The default serializer has been compatible with the Json.NET project but this compatibility has been given up since release 100.3.

Installation Installing RestSharp can most easily be done using its NuGet package:

Install-Package RestSharp

Resources

2486 questions
0
votes
1 answer

RestSharp not deserializing a string (always null)

I currently tried to get serialized response from a RestSharp PostAsync call like in var responseData = Client.PostAsync(request).Result; Now, this is what I receive: { "status":1, "success":"message transmitted", …
Helmut
  • 426
  • 3
  • 14
0
votes
1 answer

Where to add host name while adding pfx certificate in RestSharp using C#?

I'm trying to communicate with a server where I need to pass pfx cert, host and passphrase. To test the server, I use Postman. So I fill the certificate setting in postman, and my request works fine as shown here. enter image description here I see…
San jay
  • 5
  • 3
0
votes
0 answers

C# RestSharp API returns data with no Headers

I am struggling with converting JSON (obtained from a Rest API) into a C# Class. The reason that I am having difficulty is because the JSON data being returned does not appear to have any headers, which directly plays at odds with the generated C#…
mherr
  • 348
  • 1
  • 7
  • 25
0
votes
0 answers

Node js to c# communication

I have nodejs api: export const applyitem = (req,res)=>{ const { id } = req.params; const applyitems = JSON.parse(JSON.stringify(itemData)); const founditem = applyitems.find((item) => item.itemId == id); res.send(founditem);…
Mr.Curious
  • 282
  • 1
  • 3
  • 11
0
votes
0 answers

Is there a way to reorder the data sent in a multipart form POST request?

I am making a request to an external API which needs data in a multipart form to be sent in a specific order. I have two parameters for the request, one is a JsonParameter and the other is a file. The issue I am having is I need the JsonParameter to…
0
votes
2 answers

Issue After upgrading Restsharp version

Can someone please help on this issue, i gets hang and no error is coming. Seems like ends up with some unknow issue. I am attaching my code before and after upgrading the restsharp library. Code in Rest sharp version 106.12.00 using System; using…
harsh
  • 19
  • 4
0
votes
0 answers

FileNotFoundException: Could not load file or assembly RestSharp dll

I have implemented a plugin for a document application (Arxivar), the plugin (the dll) is called in the Arxivar's workflow, my plugin foresees the call to an API Rest using RestSharp, in generating the plugin for Arxivar I included the plugin dlls…
Marduk
  • 125
  • 2
  • 14
0
votes
0 answers

C# - Problems on Connect to Synology NAS with Restsharp

I can't manage to stablish a connection to Synology NAS from c# using RestSharp (or any other method) public void TryConnection() { var request = new RestRequest("/webapi/entry.cgi", Method.Post); request.AddParameter("path",…
0
votes
0 answers

Encoding used in RestSharp is not giving proper result

I'm using RestSharp 108.0.1 in my visual studio project to send http request. In my request I need to send some parameter with values like 'Ze4mdL8ed%2BXinfpW7vg2qRkX9EyQaicauJEF94TZpJEwajJ8KqXleQ%3D%3D'. When I'm sending the same request through…
Meghdut Saha
  • 85
  • 1
  • 14
0
votes
1 answer

How to implement Custom Deserializer

I have written a custom serializer and attached it to my RestClient. I am trying to also implement a custom deserializer as well. I noticed in my code that the serializer gets called when i added it to my client like so :RestClient Client = new…
0
votes
0 answers

How to integrate HttpClientFactory with Restsharp best way

I showed that Restsharp moved to a HttpClient in the version 107. But I think that is not well integrated with Httpclientfactory, because you need to pass the HttpClient in the constructor thus creating a RestSharpClient every time, see this video…
0
votes
1 answer

Getting "Bad Request" when using RestSharp

I am living in Denmark where we have the ability to pull all data regarding our power usage from the website Eloverblik.dk. They have even provided a nice API, so you can make your own programs that pulls the data from their…
0
votes
1 answer

How can I loop through API response in C#

I have a response coming from API call, I want to loop through the response to display it on UI. IRestResponse response = client.Execute(request); string responseContent = response.Content; [ { "details": { "ID": "STUD_111", …
user2240189
  • 315
  • 3
  • 7
  • 20
0
votes
0 answers

400 error is slowing down the .net core app

So our application is based on microservices architecture and it slows down after 2 days of usage. Once application is slow at that I see many 400 errors in application insights. So flow is basically angular is using .net core api which in turn…
Mukund
  • 1,679
  • 1
  • 11
  • 20
0
votes
2 answers

Convert image/png string representation into byte array in C#

From a call to an external API my method receives an image/png as an IRestResponse where the Content property is a string representation. I need to convert this string representation of image/png into a byte array without saving it first and then…
imsan
  • 359
  • 4
  • 17