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

How to use RestSharp with OAuth?

I am confused which factory OAuth1Authenticator factory method should I use. I think I should get a consumer secret token (can I get it with RestSharp?), then use OAuth1Authenticator.ForRequestToken, then obtain access token and secret access…
Sergey Aldoukhov
  • 22,316
  • 18
  • 72
  • 99
9
votes
2 answers

RestSharp Methods Throw System.Xml.XMlException "=" is an unexpected token. The expected token is ';'

I reviewed the answers to this question and see that invalid characters can cause issues that throw this error. My question is a tad different in that I'm using RestSharp to make an API call as follows: private static T Execute(IRestRequest…
SidC
  • 3,175
  • 14
  • 70
  • 132
9
votes
0 answers

How to dispose RestClient from RestSharp

Hi I am using RestClient from RestSharp nuget package, but I found it does not implement IDisposable. So do I need to dispose it or how to dispose it? The example codes are from Mailgun api: RestClient client = new RestClient (); …
DennisL
  • 293
  • 1
  • 3
  • 12
9
votes
1 answer

Simulate Postman Post in C# - RestSharp

I am doing tests on a browser game. This post request is suppose to issue a command to build a building. As long as I am logged in, I can click on the Postman Send button and it works fine. This means non of the values expires. But if I log out and…
0014
  • 893
  • 4
  • 13
  • 40
9
votes
2 answers

RestSharp converts Datetimes to UTC

I have following problem I'm using RestSharp for accessing my API. But when I'm sending a DateTime it seems to be converted to UTC. I'm sending '10.06.1991 00:00' and the API gets '09.06.1991 22:00' So, I would always need to add 2 hours when my…
9
votes
2 answers

How can I deserialize Xml list using Restsharp?

I have an xml like this 1 1
nemke
  • 2,440
  • 3
  • 37
  • 57
9
votes
1 answer

Unable to send Client Certificate via RestSharp

I'm able to access my token and add it to the RestSharp RestClient //Create rest client. IRestClient client = new RestClient("https://localhost.fiddler:44300"); var webClientCertificate = GetWebClientCertificate(); //Don't ask why... I'm getting…
Chazt3n
  • 1,641
  • 3
  • 17
  • 42
9
votes
1 answer

Upload File Without Multipart/Form-Data Using RestSharp

Below, there is a POST Request Done With Standard HttpWebRequest , and HttpWebResponse. Basically it post binanry file with some parameters. How Can I do The Same Thing With RestSharp ? Source:…
Hippias Minor
  • 1,917
  • 2
  • 21
  • 46
9
votes
1 answer

RestSharp and Twitter API 1.1: How do I correctly URLEncode status update text?

I'm trying to post a Twitter status from my web app, using RestSharp. The following code works perfectly: var status = "I am fine with posting this status."; var client = new RestClient("https://api.twitter.com"); // The OAuth keys/tokens/secrets…
Mark Bell
  • 28,985
  • 26
  • 118
  • 145
9
votes
3 answers

Can RestSharp send a List in a POST request?

I am trying to get RestSharp to work with a restful service that I have. Everything seems to be working fine, except when my object being passed via POST contains a list (in this particular case a list of string). My object: public class TestObj { …
adrianbanks
  • 81,306
  • 22
  • 176
  • 206
8
votes
2 answers

RestSharp is loading the whole file into memory when uploading. How to avoid it?

I'm using RestSharp in a Mono project to upload some files and I have noticed that when a large file is uploaded, the memory grows substantially. Looking at RestSharp source code I did notice that FileParameter expects a byte array, which means it…
Maurício Linhares
  • 39,901
  • 14
  • 121
  • 158
8
votes
1 answer

RestSharp Timeout

I have an issue with RestClient response is coming back as "StatusCode: 0, Content-Type: , Content-Length: )" with the ErrorMessage of "The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing." Is this a timeout…
Meneghini
  • 147
  • 1
  • 1
  • 10
8
votes
2 answers

Using TPL with existing async APIs

I want to use TPL with a existing API, RestSharp to be specific, so I can use continuations. But this means I have to wrap a API that doesn't take the classical .NET approach to async, but instead implements callbacks. Take some code like this: var…
Claus Jørgensen
  • 25,882
  • 9
  • 87
  • 150
8
votes
4 answers

Trust issue while sending a post to my API since DST Root CA X3 Expiration

I have a C# api running on a aws S3 with ubuntu. This API is use by a website, a windows application and a xamarin app deployed on Samsung android devices. Since today 16:00 (paris time), the android part is not working anymore, I have a "trust…
Toows
  • 93
  • 1
  • 9
8
votes
2 answers

RestRequest works local but not from azure "The request was aborted: Could not create SSL/TLS secure channel."

When I run my app in localhost it works fine but when I publish it to Azure my request stop working. Getting the error : "The request was aborted: Could not create SSL/TLS secure channel." I have an app that calls a external commercial Soap-API. The…
Carl Decks
  • 385
  • 4
  • 15