Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:23
  • Nov 30 15:49
    difrancosimone starred restsharp/RestSharp
  • Nov 30 14:06
    slacki123 commented #1620
  • Nov 30 07:58
    maxchiu starred restsharp/RestSharp
  • Nov 29 22:09
    cloudflare-pages[bot] commented #1655
  • Nov 29 22:05
    cloudflare-pages[bot] commented #1655
  • Nov 29 22:05

    dependabot[bot] on github_actions

    Bump actions/setup-dotnet from … (compare)

  • Nov 29 22:05
    dependabot[bot] labeled #1655
  • Nov 29 22:05
    dependabot[bot] labeled #1655
  • Nov 29 22:05
    dependabot[bot] opened #1655
  • Nov 29 16:13
    LinaEagle starred restsharp/RestSharp
  • Nov 29 09:37
    wuhudage starred restsharp/RestSharp
  • Nov 27 17:53
    suho starred restsharp/RestSharp
  • Nov 26 09:04
    alexeyzimarev commented #1517
  • Nov 26 09:03
    alexeyzimarev commented #1517
  • Nov 26 09:03
    alexeyzimarev commented #1517
  • Nov 26 07:43
  • Nov 26 01:04
    JimmyRice starred restsharp/RestSharp
  • Nov 26 00:45
    TrendCare-Alex opened #1654
  • Nov 25 23:24
    TimSirmovics commented #1517
phungne
@phungne
@happysammy do you have try this solution ?
Adrian Strangfeld
@AdrianStrangfe1_twitter

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:
<root>
<list-item></list-item>
<list-item></list-item>
</root>

instead of

<root>
<list>
<list-item></list-item>
<list-item></list-item>
</list>
</root>

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
@AdrianStrangfe1_twitter
I got it to work using the DotNetSerializer. Is there a way to do it with the other one? (XmlSerializer)
Adrian Strangfeld
@AdrianStrangfe1_twitter
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
@smathson_twitter
Hey all, is documentation for older versions of the library available anywhere?
Enrico Rossini
@erossini
Hello everybody. Is there possible to have logs from RestClient?
Marko
@MarkoniB
Can RestClient be disposed after executing the request?
Maxime Veber
@Nek-
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
@Nek-
Fixed it, JSON was not what I expected.
S Wulf
@DustRaven
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
@marcelkr_gitlab

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
@kbeckersbj
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
@OrchardSkills
Where are the Docs for RestSharp? Does it support Authorization Code Flow with Proof Key for Code Exchange (PKCE)?
tristenDCM
@tristenDCM
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.
tristenDCM
@tristenDCM
Solved my problem!
Kallum Burgin
@Kallb123
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
@claytoncassar
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.
radz1
@radz1
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}");
        request.AddJsonBody(mYtype);          

        var httpClient = new RestClient("service url");
        IRestResponse clientResponse = httpClient.Execute(request);
radz1
@radz1
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
RuyMaster
@ruymaster
Hello
I am working with a project for .NetStandard2.0 and there is an error for RestSharp.
{"Could not load file or assembly 'RestSharp, Version=106.0.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75' or one of its dependencies. The system cannot find the file specified.":"RestSharp, Version=106.0.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75"}
How can I fix that? I tested with latest version, but I can't fix that.
RatedFreelancer.com
@ratedfreelancer_twitter
Hey folks, I am having problem with restsharp on Azure app service. Getting "Unable to connect to remote server" as the error. The same code works locally without any alteration. Does anyone has any idea on how to resolve this?
猎艳
@lantongxue
hello every one.
i have a question
how to set SOCKS5 proxy to restsharp ?
Randeep Saini
@pwrp4j1
Hi Guys, is there an easy of running a Long Poll with Rest Sharp? Currently I am just downloading the query result every so many miliseconds using GetAsync<T>
vishak os
@vichu28_twitter
Hi All, I’ve a requirement to make a call using HTTP Post with MutualTLS authentication.
The call is initiated to the external API endpoint upon a button click from an ASP.Net 4.6.1 MVC App.
I’ve added my application certificate as X509 in the ClientCertificates. In order to perform server certificate validation for mutual TLS , what should be done.
If there are any reference implementation on making this call, or any pointers to achieve mutual TLS, it’ll be highly appreciated. Thank you!
paimon
@notpaimon
OAuth2Authenticator is obsolete, that means we have to implement IAuthenticator and write the implementation ouself?
nadvolod
@nadvolod
Hello, what's the correct way to download a video using RestSharp?
Paweł Ślusarczyk
@azsdaja
Hi! I'm getting the following exception when calling JsonConvert.Serialize(restRequest):
Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'ManifestModule' with type 'System.Reflection.RuntimeModule'. Path 'OnBeforeDeserialization.Method.Module.Assembly'.
Any idea?
I'm using the newest versions of both RestSharp (106.11.7) and Newtonsoft (12.0.3) in .NET 5.
1 reply
Irnel Victoria Sosa
@irnelfcb_twitter
Hi every one, Im using restsharp version net framework 3.5, Im tested locally and works fine, but in public server dosnt work
Indrit Zeqiris
@ilstarno
Hi everyone is anyone that has experience with restsharp cookie authorization?
Gayan Ranasinghe
@gayan-rb
Is there any way to use RestSharp with IServiceCollection (dependancy Injection)
Geral
@Geral3
is there a way to force ipv4?
593172440
@593172440
client.Execute<FloorIPAddress>(restget2)
"StatusCode: OK, Content-Type: application/json; charset=utf-8, Content-Length: -1)"
Content: "{\"id\":88,\"floorName\":\"综合楼外网\",\"floorCeng\":\"5层\",\"weiZhi\":\"四号井\",\"ipName\":\"10.12.20.X\",\"beiZhu\":null}"
ContentEncoding: ""
ContentLength: -1
ContentType: "application/json; charset=utf-8"
Cookies: Count = 0
Data: null
ErrorException: {"未能加载文件或程序集“System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。系统找不到指定的文件。":"System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}
ErrorMessage: "未能加载文件或程序集“System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或它的某一个依赖项。系统找不到指定的文件。"
Headers: Count = 4
IsSuccessful: false
ProtocolVersion: null
RawBytes: {byte[115]}
Request: {RestSharp.RestRequest}
ResponseStatus: Error
ResponseUri: {http://112.112.112.18:81/api/FloorIPAddresses/FloorInfoForIP/10.12.20.12}
Server: "Kestrel"
StatusCode: OK
StatusDescription: "OK"
Data:null ????麻烦大佬look look
Arun Chaulagain
@realac18_twitter
Hello! I have small query. Does RestSharp implement response caching by default?