Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 17:31
    kkolodziejczak starred restsharp/RestSharp
  • 15:59
    Ducatel edited #1538
  • 15:40
    Ducatel edited #1538
  • 15:39
    Ducatel opened #1538
  • 15:01

    alexeyzimarev on dev

    Changed tha to who changed tha… Merge pull request #1537 from d… (compare)

  • 15:01
    alexeyzimarev closed #1537
  • 14:59
    alexeyzimarev commented #1532
  • 14:54
    devamitk edited #1537
  • 14:19
    superboy009fork starred restsharp/RestSharp
  • 14:07
    qamessenger closed #1532
  • 14:07
    qamessenger commented #1532
  • 13:52
    devamitk opened #1537
  • 11:34
    Shujee closed #1533
  • 11:34
    Shujee commented #1533
  • 11:02
    archimed7592 commented #1517
  • 10:49
    alexeyzimarev commented #1532
  • 10:48
    alexeyzimarev commented #1517
  • 10:41
    alexeyzimarev labeled #1517
and I've not been able to find how to use it correcly
anyone can show me an example please?
ExecuteAsync don't support callback?
Hi Folks, I am using RestSharp version I am sending file from my C# application to rest api using request.AddFile(name, path). However, I get the response as bad request. Sample code request.AddFile("00003800", @"C:\Temp\test\00003800.pdf". Any help is appreciated.Thanks!
Hi Everyone, Facing an issue with Restsharp v 106.11.4 , api returns an status code 0 what does that mean

Hi Everyone, i have issue on my production env
Exception=System.Net.WebException: Only one usage of each socket address (protocol/network address/port) is normally permitted Only one usage of each socket address (protocol/network address/port) is normally permitted ---> System.Net.Http.HttpRequestException: Only one usage of each socket address (protocol/network address/port) is normally permitted ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n --- End of inner exception stack trace ---\r\n at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.ValueTask1.get_Result()\r\n
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n
at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask)\r\n
at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\r\n at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at System.Net.HttpWebRequest.SendRequest()\r\n
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)\r\n --- End of inner exception stack trace ---\r\n
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)\r\n
at RestSharp.Http.GetRawResponseAsync(IAsyncResult result, Action1 callback)\r\n at RestSharp.Http.ResponseCallback(IAsyncResult result, Action1 callback);`

i'm used cmd: netstat -na to check port so i see a lot of PORT was created.

Any solution for this issue, pls help me

I'm using
  • Restsharp: .NET core 2.2.1 with Reshsharp v106.11.5-alpha.0.2
  • Here my code Client invoke Restfull API
    `RestClient _RestClient = new RestClient(CoreHelper.InnoAppConfig.LinkApiUrl)
                  Timeout = CoreHelper.InnoAppConfig.Timeout,
                  CookieContainer = new CookieContainer() ,
                  Pipelined = CoreHelper.InnoAppConfig.RestConfig.EnablePipelined,
              };IRestResponse<string> response = await _RestClient.ExecuteTaskAsync<string>(_request);
                  return response.Content;`
Sammy Shi
Hi, i just ran into same error message " Only one usage of each socket address (protocol/network address/port) is normally permitted" , so should i need to switch to using HttpClient to solve this problem?
Hi, I am Santosh, recently started working on RestSharp for RESTAPI testing. Do we have any RestSharp API documentation that I can refer to.
oops sorry
im having trouble choosing the correct overload

Hi, do we have oAuth 2.0 support documentation for RestSharp. I don't find any kind of API documentation for RestSharp in website. https://restsharp.dev/usage/authenticators.html

Please provide some help to locate the documentation

Can anyone help me with the API docs
Hello Everyone, Is anyone maintaining this channel? or left abundant> I have asked a question and look for support
@happysammy do you have try this solution ?
Adrian Strangfeld

Hello everybody. I am facing a deserialization problem. Hopefully someone can help me out.
I have to deserialize a list without a container item. It has the following format:

instead of


How can I archive it?

I upgraded to the newest rest sharp version hoping the "Content"-Property of the DeserializeAsAttribute would do the trick, but it did not help.
I think I should mention that it is a list inside of a list. I recently had problems with that too. Can Restsharp handle this?
Adrian Strangfeld
I got it to work using the DotNetSerializer. Is there a way to do it with the other one? (XmlSerializer)
Adrian Strangfeld
I got it to work: The "Content"-Property of the DeserializeAsAttribute did the trick. I did mess it up on my first try.
Scott Mathson
Hey all, is documentation for older versions of the library available anywhere?
Enrico Rossini
Hello everybody. Is there possible to have logs from RestClient?
Can RestClient be disposed after executing the request?
Maxime Veber
Hello people ! I'm new to restsharp and feeling soooo stupid >_<
Here is my code
And the error is also on the gist.
I don't understand what's wrong !
Maxime Veber
Fixed it, JSON was not what I expected.
S Wulf
Hi everyone :) Can i force RestSharp to use ipv4 instead of ipv6 or do i have to disable ipv6 completely? v6 causes about 20 seconds of delay on the first request :/
Marcel Krüger

Hi all, is it expected that the current locale changes the way the decimal separator is represented in GET requests (and possibly other places)?
E.g.: My system is set to german locale and unless I turn floats to strings myself with the invariant locale when adding them to a request, floats get separated with , in the URL. This confuses the API I want to talk to.

Minimal example:

float a = 1.2f;
var request = new RestRequest("column/longitudinal/diameter_quantity", DataFormat.None)
    .AddParameter("a", ParameterType.QueryString);
var response = restClient.Execute<LongitudinalDiameterAndQuantity>(request, Method.GET);

results in a request to URL /column/longitudinal/diameter_quantity?a=1%2c2

Instead of ., a , is used encoded as %2C

Kevin Becker
I'm using RestSharp.RestRequest.AddObject to add an arbitrary object to a post request. This mostly does what I need by converting my object into "PropertyName=Value&..." etc. However, I want to use different property names without having to actually use different property names. Something like what Newtonsoft.Json does with the data attribute: [JsonProperty(PropertyName = "myPropertyName")]
Orchard Skills
Where are the Docs for RestSharp? Does it support Authorization Code Flow with Proof Key for Code Exchange (PKCE)?
Has anyone used RestSharp in a Unity project, building for the UWP for the Hololens 2? I'm getting many 'doesn't exist in target framework' errors because of System DLLs. My target framework is .NET Framework 4.7.1 in Visual Studio.
Solved my problem!
Kallum Burgin
I've used OpenAPI CodeGen to generate a C# client, which appears to be using RestSharp. It's been working fine, but I'm now switching over to HTTPS. I've generated a SSL certificate, installed it on the server, trusted it in my Windows Trusted Root Authority Store and RestSharp is giving me the error: SecureChannelFailure. The exact same endpoint works fine in Chrome, Firefox, Powershell Curl. RestSharp just won't connect.
Clayton Cassar
Probably asked a million times but I cannot find proper documentation. Should I inject my RestSharp client API classes as singleton or transient. I know all about HttpClient to be singeton, but not sure how RestSharp behaves.
Hi guys, i am trying to call a post API with string payload using latest rest sharp version 106.11.7
it is working with the previous version 106.3.1
but in latest version, i am getting bad request. i am updating the library to latest one. please help
MYtype mYtype = new MYtype { Id = "6b2df639-9406-4c67-ba17-7d55b7547c46" };
var request = new RestRequest(Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddHeader("Content-Type", "application/json;");
request.AddHeader("Authorization", $"Bearer {accessToken}");

        var httpClient = new RestClient("service url");
        IRestResponse clientResponse = httpClient.Execute(request);
Service signature :
public async Task<IActionResult> InsertOrUpdateSettings([FromBody]string strSettings)
I am able to hit the service but parameter is null. Same code is working fine with last version