Questions tagged [restsharp]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

CS0117 - 'Method' does not contain a definition for 'POST'

I have the following code and I'm not sure how to fix it client = new RestClient("https://xml.channelonline.com/REQUEST"); request = new RestRequest(Method.POST); request.AddHeader("...
Karim Momo's user avatar
0 votes
1 answer
40 views

LinkedIn API image upload reliably PROCESSING_FAILED

I'm having some difficulty with the image upload feature, and I'm hoping somebody already knows the answer... I'm following these steps: POST to initialise an upload (and get the upload URL) PUT the ...
instantiator's user avatar
0 votes
1 answer
36 views

Timeout exception on a service bus triggered function when external api is taking more than 4 minutes ro rerurn response

I have a service bus triggered function that is makikg a post request to an external api. The function is working correctly when the api responds in 2 or 3 minutes, but when the api responds in 6 ...
Aifoz's user avatar
  • 91
0 votes
0 answers
42 views

Swagger CodeGen for RestSharp Version 102.2.0

I would like to ask if there is a Swagger tool that can generate clients according to the latest version of RestSharp (110.2.0). I've noticed that Swagger Codegen currently uses RestSharp version 102....
Teboho's user avatar
  • 21
0 votes
1 answer
35 views

Deserialize automatically response with RestSharp

I've read several topic on stack overflow and Google but I can't find the solution. I've this method var client = new RestClient(base_url); var request = new RestRequest("/action/findOne"); ...
Federico Cuozzo's user avatar
0 votes
1 answer
46 views

RestClient doesn't contain definition for BaseUrl and no accessible extension method BaseUrl accepting a first argument of type RestClient found

I'm new to programing and I'm having some difficulty with something I'm trying to do - trying to write code in C# to get contacts stored in a MongoDB DB back into Salesforce, there is an error about ...
iluvcode's user avatar
0 votes
0 answers
17 views

How can we disable UseNagleAlgorithm in RestSharp v107+? [restsharp]

In RestSharp v107+ ConfigureWebRequest was removed and we were using it in this way. _client.ConfigureWebRequest(request => { request.ServicePoint.UseNagleAlgorithm = Configuration....
Emin Salim's user avatar
0 votes
0 answers
15 views

Sending an array of strings with restsharp

I am trying to include a tag when I am calling the Freshdesk outbound_email API, in the API docs it says the type for tags is an array of strings, so I want to send something like ["tag1", &...
James Wilson's user avatar
0 votes
0 answers
62 views

Twitter API v2 with RestSharp

I've been trying to understand the new Twitter API for a while now. For this I have helped myself to the RestSharp library. In itself I would also like this code to work in vb.net I have the basic ...
Lewnox's user avatar
  • 1
0 votes
2 answers
92 views

Deserialize RestClient response Enum Conversion Error - The JSON value could not be converted to Enum

In our asp.net application, we recently upgraded from restsharp 106.12.0 to 110.2.0. There were no issues with the old version, but after upgrading with few changes to code, we are getting the errors: ...
Hakuna Matata's user avatar
0 votes
1 answer
22 views

RestSharp Request.AddFile parameter order

I'm trying to do a POST with a CSV file to a REST endpoint using RestSharp. However, after some extensive tinkering, I've found that the receiving server is picky about the order of the headers in the ...
John's user avatar
  • 2,663
-1 votes
1 answer
87 views

How can I use RestClient (RestSharp v107+) and Polly?

HttpClient has some handy extensions via Microsoft.Extensions.Http.Polly which lets us configure a retry policy factory and and use AddPolicyHandler to add the retry policy while configuring a ...
Ayushmati's user avatar
  • 1,473
0 votes
1 answer
19 views

Trying to send an attachment with my post request to the fresh desk outbound_email end point

I am trying to use RestSharp to call the outbound_email endpoint from the fresh desk API. I want it to send an email which includes an attachment. If I don’t include an attachment I am able to post to ...
James Wilson's user avatar
2 votes
2 answers
99 views

Mock of RestSharp IRestClient fails with NullReferenceException even when actual implementation works fine

I have been racking my head over this for a few days and need to ask this of the community. I've developed in c# for some time, but very new to actually using async. I am making a Rest API client and ...
BBrowsk6605's user avatar
0 votes
2 answers
49 views

How do I add x-api-key header in RestSharp v107+ to add API Key?

I'm trying to call a secure web API using RestSharp v110. I need to add an API Key to the request by adding the x-api-key header. There's many examples of using RestSharp.AddHeader but, as of v107, ...
AfmetDev1's user avatar
0 votes
1 answer
41 views

Restsharp Upload BufferedStream (File)

I had written an .net MAUI application for my own to work with an third Party API based Application. Inside the application there is a file picker to get the file. private async void file_Clicked(...
Andre's user avatar
  • 1
0 votes
2 answers
163 views

Calling an API Get with RestSharp

So I have the following API end point. It works when called from postman and swagger. [ApiController] [Route("api/GetPersonList")] public class GetPersonListController : Controller { [...
Ashley Kilgour's user avatar
0 votes
1 answer
55 views

RestSharp does not deserialize properties with pascal case and underscore

I am using RestSharp in an application that expects JSON like the following [{ "Id": 1, "Material_Composition": "material composition", "...
hmayed's user avatar
  • 51
0 votes
1 answer
40 views

Refactoring my httpclient into a restsharp in my .Net Maui app getting Could not resolve type with token with a simple attempt to connect

I am trying to integrate RestSharp into my project, but am getting this error: System.TypeLoadException: 'Could not resolve type with token 010000d5 from typeref (expected class 'RestSharp....
ReticentRobot's user avatar
0 votes
0 answers
68 views

RestSharp POST request - Body x-www-form-urlencoded values

I'm trying to convert some API tests that were done using POSTMAN. The problem I'm facing is to do a POST request to get a token + refreshToken. ** OBS: I'm pretty sure I'm using the same client_id + ...
Bruno Lorena's user avatar
0 votes
0 answers
26 views

After install RestSharp, Visual Studio debugging got error: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents

I would like to use RestSharp, but after install RestSharp, runing Visual Studio debugging got error: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this ...
startover's user avatar
0 votes
0 answers
49 views

code 422 status failure message Invalid Payload

I want to get tracking detail using rest api My code returns the following message: {"code":422,"status":"failure","message":"Invalid Payload! Please check ...
Samee Ullah's user avatar
0 votes
1 answer
31 views

Authentication implemention problem with Auth0 and Winforms

I wonder if anybody can assist me. I am deeply, deeply frustrated by trying to implement what I understand should be a fairly straightforward authentication implementation. My objective is to have ...
user3561406's user avatar
0 votes
1 answer
85 views

RestSharp failing to instantiate RestClient on live server, but works fine on local machine

I recently updated restsharp nuget package to 110.2.0 from what I believe was 110.0.0 (not totally sure though). We use rest sharp to send orders to a supplier of ours, and the code was working fine ...
Rob_Da_Joyce's user avatar
0 votes
1 answer
56 views

RestSharp cannot send body content with get() method

I have using API from a courier company and I have to send body content in Get Method if I used POST Method it said it is not allowed and when use get it send me message you cannot sent body content ...
Samee Ullah's user avatar
0 votes
0 answers
82 views

restsharp latest version v110.2.0 filename encoding issue

I'm using the latest stable version of restsharp (v110.2.0) to upload zip file to external link with name "Präsentation_Export" but after successful upload got "Pr�sentation_Export"...
Karlin Joe's user avatar
0 votes
1 answer
56 views

Error trying to deserialize RestSharp response

I ran into an error in this piece of code public PaymentResponse CreatePaymentRequest(string amount, string mobile, string email, string description, long orderId) { amount = ...
Unknown's user avatar
  • 15
1 vote
0 answers
52 views

Including time in RestSharp call returns empty response

I'm new to creating API clients and RestSharp. I'm trying to use RestSharp to make a request to an API maintained by one of our vendors. The API accepts two parameters of either to and from date or ...
dsugden's user avatar
  • 11
0 votes
0 answers
39 views

RestSharp API Request Invalid JSON String Response

I have some code to connect to an API Endpoint. First I get the access token, then I use that to connect to the endpoint and try to get a JSON response, however I keep getting the an Exception ...
High Plains Grifter's user avatar
0 votes
1 answer
45 views

Rest API call Request returning null

Using RestSharp, want to make a simple call to this API: https://dbd.tricky.lol/api/characters Specifically, I want one of the characters as an object in my C# Program. Here's the call: var options = ...
Herbix's user avatar
  • 35
1 vote
0 answers
63 views

What is RestSharp doing differently than a simple HttpClient implementation (Endpoint does not accept RestSharp POST)

I was trying to send a POST request with an XML body to an endpoint using RestSharp. I have had good results working with JSON so I wanted to test it once. But I always get a NotAccepted result and I'...
zesaro's user avatar
  • 33
0 votes
2 answers
242 views

How to deserialize json array of objects into object with properties?

I am working with the following JSON string from api response: { "points": [{ "name": "title", "value": "Test" }, {...
b166er's user avatar
  • 319
0 votes
0 answers
115 views

Using http2 in RestSharp

Can you please tell me how to use http2 with RestSharp? I tried to set up my own HttpClient and set the protocol settings for it, but it still doesn't work I’ll make a reservation right away, the ...
Artem Pokamestov's user avatar
0 votes
2 answers
76 views

Post image with restsharp

I'm trying to post image to Instagram using my private API. I can do it successfully using the graph API but I'm trying to do it with my private API as a sort of challenge but there's a week I'm stuck....
HomerSimpsons's user avatar
1 vote
1 answer
85 views

What is the best way to perform several API requests in C#?

I have a problem to resolve at work. I have a .NET application, where I need to make several requests, one after the other, to an endpoint in an API, however, this API has many request problems, and ...
Willian Lopes's user avatar
0 votes
0 answers
77 views

How to properly dispose socket

Good day, how can i close sockets of RestClient/HttpClient properly for checking list of proxy(~50000+ units) on proxy judge (ex. azenv.net) as fast as possible. The problem is - this code create a ...
AnyAid's user avatar
  • 31
0 votes
0 answers
32 views

Restsharp does not know when the other party cuts off the internet

I have an application that consumes a REST API running on an Android device. One test that I have to do, is to cut the smartphone Wi-Fi while in the middle of a request, but Restsharp never react and ...
Lechucico's user avatar
  • 1,914
0 votes
2 answers
177 views

Get stream with RestSharp as it's being streamed from the server

My server constantly streaming data and I want to read it on C# app. I found that I can use RestRequest.ResponseWriter but it's only called once when the server done streaming. How do I get data as it'...
theateist's user avatar
  • 13.9k
0 votes
2 answers
91 views

C# RestSharp JSON Syntax

I seem to have a syntax problem with my JSON body. The code is intended to retrieve the balance from LetterXpress using an API, but instead of being able to authenticate, I receive the response: (&...
fabB's user avatar
  • 1
0 votes
0 answers
32 views

Disable http Expect100Continue

I am making a POST request with RestSharp and I want to disable a return code of 100. I set it to false in my restOptions but it doesn't work. What am I doing wrong? var restOptions = new ...
Tacy Nathan's user avatar
0 votes
0 answers
145 views

Error "401-Unauthorized" when consuming REST API hosted in IIS with Windows Authentication from Android device

Using RestSharp in .NET MAUI to develop the mobile app, I am actually trying to connect to the REST API hosted in IIS 10 with Windows Authentication (NTLM). Due to security reason, I have to use ...
JR Lee's user avatar
  • 1
0 votes
0 answers
66 views

UTF-8 string encoding in .NET for shipping with Restsharp

I have developed a program that generates a digitally signed XML file, encoded in UTF8, which I send to an API. The problem is that when certain characters are included, such as "or", the ...
jalonsoc's user avatar
0 votes
0 answers
154 views

Restsharp Picnob Response as forbidden

I am trying to download html from website picnob.com, When I request using POSTMAN it gives full html. But when I do same with my c# code it gives "forbidden" error. Below is postman code ...
vaibhav shah's user avatar
  • 4,959
-1 votes
1 answer
59 views

Posting an object with list of strings

I am using RestSharp 110.2.0 on .Net 7 Everything works fine if I "AddStringBody", however I cannot seem to add an object using "AddJsonBody". This is the body that works (ie ...
Ben Levy's user avatar
  • 129
0 votes
1 answer
117 views

RestSharp DownloadData out of memory exception in .net app

I have facing System.OutOfMemoryException which is occurring in case I try to download some files (26mb) while the memory available is larger than the download file as many times (1gb). Any idea. ...
Dev Mktb's user avatar
-1 votes
1 answer
59 views

RestSharp deserializes an object property incorrectly

I developed an API method that is called from other C# method. I defined this class: public class ApiResult { public bool success { get; set; } public string message { get; set; } = string....
jstuardo's user avatar
  • 3,941
1 vote
2 answers
273 views

Moving from RestSharp to HttpClient

Currently we are using RestClient from RestSharp library like below. var client = new RestClient("<some url>"); var request = new RestRequest("", "GET"); request....
XamDev's user avatar
  • 3,405
0 votes
0 answers
44 views

Is it possible to use RestSharp without passing the server address? (or better saying, with relative URL)

I am developing a .NET Core 7 application, using RestSharp to make calls to API inside the same application. I tried using this contructor: using var client = new RestClient("/api/path/GetById/2&...
jstuardo's user avatar
  • 3,941
0 votes
1 answer
399 views

How do I catch validation error in C# WebAPI

I have a C# Web API. It has a controller which has a POST method in it. The model class I pass has some data annotations (e.g. Required, MaxLength, etc). I am calling it from a client using RestSharp. ...
BuckBuchanan's user avatar
0 votes
0 answers
150 views

Azure function app with RestSharp getting cannot find System.Text.Json 7.0.0.0 errror

I have tried what was suggested in RestSharp: Could not load file or assembly 'System.Text.Json, Version=7.0.0.0 and it didn't work for me. I am just trying to get it to work on my machine right ...
DanielGroff's user avatar

1
2 3 4 5
50