2,509 questions
0
votes
1
answer
57
views
URL segment changing with subsequent call to AddUrlSegment
I have a situation where part of my code sets a URL segment to a value, and then calls the code that executes the request with a retry if authentication fails.
Part of refreshing the authentication ...
0
votes
0
answers
55
views
Empty value HTTP POST Multipart/form-data field using RestSharp
Good morning, I am facing the following issue when sending this request, which requires a Multipart/form-data with one parameter receiving a JSON and another receiving the file. Currently, this is the ...
2
votes
1
answer
128
views
RestSharp stops working in installed version of software
I am using RestSharp for the first time, having installed it via NuGet.
Everything works wonderfully in my development environment. I have now created an installer for my software by means of an MVS ...
1
vote
1
answer
74
views
Removing a JSON element that should be an array
I am trying to use RestSharp to deserialize a JSON return into C# classes. The return sometimes contains a single, empty object when the data definition calls for an array of objects. If there is ...
0
votes
0
answers
35
views
RESTsharp seems to cause error in Release build of Windows UWP App
We needed to send REST API requests to the Google and Zoom APIs from our UWP App, so we decided to use RESTsharp
The code that uses RESTsharp all works fine when we build the UWP App in Debug.NET ...
1
vote
2
answers
136
views
How to send a simple string in a body of a Post request in RestSharp
I have an API that receives a string token. This API has a Post method, and is expecting the string in the body:
[HttpPost("refreshToken")]
[Produces(MediaTypeNames.Application.Json)]
public ...
0
votes
1
answer
76
views
RestSharp returns "Invalid Content-Range header." on final file chunk with MS Graph API
I have been at this for a week and it's getting frustrating. On the final upload request, I get the error "Invalid Content-Range header." All other chunk uploads are successful, only the ...
1
vote
0
answers
95
views
RestSharp and undefined delay for CancellationTokenSource following upgrade to .net8
I recently upgraded an internally developed Windows application from .net 6 to .net 8, and all nuget packages it uses, including RestSharp to version 112.1.0.
Since then, every request made with ...
1
vote
1
answer
292
views
DataMember Name attribute ignored when deserializing a JSON object
I have an issue deserializing a JSON object into my class.
I have a class DocumentListByPolicy that is used as a List<> in another class. For the document list, this is my code:
namespace ...
0
votes
0
answers
78
views
RestSharp.RestResponse.Content is truncated in C#
Receiving below truncated response where as the rawbyte has full data while calling a Rest API in c# using V112.1.0.
RestSharp.RestResponse}
Content: "[{\"ClientId\":\"...
1
vote
1
answer
764
views
Restsharp TLS 1.2 or 1.3 configured but callback says it is still Version 1.1
I use an Restsharp RestClient (Edit. .net Framework 4.8) and set the TLS protocol before I do the first web service call via
ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType....
0
votes
0
answers
28
views
Rest request to HDFC mutual fund giving Forbidden error in C#
I am trying to fetch information of HDFC mutual fund scheme data from its website.
Bellow is Code
var options = new RestClientOptions("https://cms.hdfcfund.com")
{
...
0
votes
1
answer
54
views
Sending file using RestSharp does Contain File
I want to upload a File using Post. When using Postman everything works fine and the file is uploaded as expected, but when I try the same with RestSharp my File is always empty.
Am I doing something ...
1
vote
1
answer
137
views
UPS OAUTH authorize API integration getting timeout
In UPS OAuth API integration, we are getting a timeout on API response. When we try a request with CURL, we are getting a http 302 successful response. But in RestSharp / C#, we get timeout.
C# code:
...
0
votes
1
answer
216
views
RestSharp requests became working when I intercept them with Fiddler Everywhere
There's a ridiculous problem.
I send a POST request to an API and it goes smoothly with programs like Postman/Bruno. But with libraries like RestSharp/Flurl/HttpClient, I was getting 400 responses.
...
0
votes
1
answer
97
views
Why RestSharp is unable to deserialize the received JSON?
I'm trying to retrieve a list of users of my JIRA instance:
options.Authenticator = new HttpBasicAuthenticator(_jiraConfig.UserName, _jiraConfig.Token);
options.BaseUrl = new Uri(_jiraConfig.Url);
...
0
votes
0
answers
113
views
"could not connect ssl/tls secure channel" error while using RestSharp in .NetStandard2.0
I am getting "could not connect ssl/tls secure channel" error while trying to call our API from Windows application. The dll used in Windows Application targets .Net framework 4.8 and it ...
2
votes
1
answer
152
views
.NET 8 RestApi Request ContentType becomes null
When I add ContentType header to request it becomes null instead of application/json. I can see it in the debugger. Here is the code
RestClient client = new RestClient(url);
client.Timeout = -1;
...
1
vote
1
answer
369
views
How to call HttpClient PostAsync or SendAsync with bearer token to get XML with XML argument?
The call with bearer token to get XML with XML argument is done so far with RestSharp
where
XElement Payload = <Access><AppID>35</AppID><UserToken>QrEil9L9S</UserToken>&...
0
votes
0
answers
54
views
How to distinguish between network/server/serialization errors in granular manner?
I have a simple REST client written using RestSharp.
var opts = new RestClientOptions("http://api.muyservice.com/")
{
// ResponseStatus should not be an Error when deserialisation failed....
0
votes
0
answers
299
views
The request was aborted: Could not create SSL/TLS secure channel exception calling openai api from windows 2012 R2 server
In a C# DOTNET 4.8 ASP.NET MVC 5 project running on a Windows 2012 R2 server, I call OpenAi API (v1/chat/completions) using the RestSharp.RestClient like this:
ServicePointManager.Expect100Continue = ...
0
votes
1
answer
34
views
How to Setup RestClientCall in Xunit
I had the code below to set up the rest client. But after upgrading to.NET 8 and upgrading RestSharpt to the latest version, RestResponse is giving an error saying 'There is no argument given that ...
0
votes
1
answer
104
views
Unable to query NTLM-protected APIs from within a Docker Container
We are building a Worker service that we want to host in a Docker container. This container interacts with the REST APIs for our on-premise SharePoint server. Authentication in SharePoint REST APIs ...
0
votes
0
answers
79
views
How to use AdvancedResponseWriter with new signature
I was using AdvancedResponseWriter as shown in code below in order to save incoming stream in file. But in the new version of RestSharp the method changed it's signature to get Func <...
0
votes
1
answer
71
views
Modify Content-Type value in boundary/form data
Is there any way in REST Sharp version 111.3 to modify the Content-Type value inside the form data?
Below is an example outgoing call I captured with Fiddler. As you can see, the content is JSON (...
0
votes
0
answers
58
views
can Restsharpsigned 105.2.3 nuget package upgrade to Resharp 111.4.0 without any major changes?
I have read that Resharp does not provide support for RestSharpSigned 105.2.3. I wanted to update it to RestSharp 111.4.0. But I dont want to do ant major changes.
any good link or support to read ...
1
vote
1
answer
186
views
RestClient as Singleton
The documentation of RestSharp contains the following section:
RestClient lifecycle
Do not instantiate RestClient for each HTTP call.
RestSharp creates a new instance of HttpClient internally, and ...
1
vote
1
answer
1k
views
Using Polly v8 and RestSharp, how would I build a Generic ResiliencePipeline to account for response header retry-after, exceptions, and logging
I have an API client class built using _client = new RestSharp.RestClient(...); with methods of this form:
public async Task<TResponse> PostAsync<TRequest, TResponse>(string resource, ...
0
votes
1
answer
91
views
Ability to set ClientCertificates after instantiating RestClient or custom Factory?
Our .NET application currently uses RestSharp v106 and Ninject. It uses client certificates to authenticate the user with a secured server. The user starts the application, selects one of the ...
0
votes
0
answers
193
views
Get octet-stream with ExecuteAsync from RestSharp without headers
I use RestSharp in version 111.2.0.
All our requests are build in this way:
internal async Task<byte[]> GetFileAsync(int documentId)
{
RestRequest request = new RestRequest($"{_apiPath}/...
0
votes
1
answer
404
views
crypto.com exchange C# API - How to
crypto.com exchange API has close to no documentation available, at least for C#.
I am trying to get as little as the account summary, and failing miserably.
Can we try to have the right functions ...
0
votes
1
answer
118
views
Can we re-use a RestClient for calling different TCP endpoints?
The documentation at https://restsharp.dev/v107/#recommended-usage says:
Do not use one instance of RestClient across different API clients.
Our use-case is calling callback URLs received in ...
0
votes
1
answer
457
views
Is there a way to run a Postman collection directly from C# code?
I need to automate some APIs using RestSharp. I have a Postman collection with all the APIs. I was wondering if there is a library available out there that reads a Postman collection and executes API ...
1
vote
1
answer
118
views
working in postman ,but not working from vb.net code,giving internal error
when trying to send the request through postman ,works fine . but gives the following error ,when using it direct from vb.net code
we are using Lib RestSharp and version 106.15.0.0
the error ...
0
votes
3
answers
121
views
OAuth1Authenticator class not found
I'm trying to use OAuth 1.0 authentication with RestSharp. Visual Studio can't seem to find the OAuth1Authenticator class. What's causing this issue?
using RestSharp;
using RestSharp.Authenticators....
0
votes
2
answers
509
views
How to reuse RestSharp RestClient instance for many requests that do not have same base URI?
RestSharp Documentation
I can use the HttpClient instance created without any base URI, and add all details in HttpRequestMessage to reuse the HttpClient instance.
class Example
{
private static ...
0
votes
1
answer
150
views
How to configure RestSharp test to run on AzureDevOps
Its my first time of implementing a test framework with RestSharp + NUnit. I have not seen any information on Restsharp page stating it support for AzureDevOps.
I just wanted to know anyone had ...
0
votes
1
answer
45
views
RestSharp deserialize XML node inside a parent node
I'm calling an API service that wraps all responses surrounded by a Response element:
<?xml version="1.0" encoding="UTF-8"?>
<Response xmlns="http://www.example.com/...
0
votes
1
answer
100
views
Twilio package missing many dependencies
I am very new to VB.net. I understand that I need to add the Twilio and RestSharp packages to my project via NuGet. After some strange behavior where the libraries disappear and reappear (like show up ...
0
votes
2
answers
316
views
.Net Core Web API is performing slower than .Net Framework | Rest Sharp Request
I have a server running locally on my machine, and two different environments/projects, .Net8 (or any other .Net core version) and .Net Framework 4.8 performing post request on server with same ...
0
votes
1
answer
218
views
Restsharp request to microsoft graph coming back unauthorized
I am attempting to access some graph items with a RestSharp request. I know I need to somehow use the client ID and secret to obtain a token and use that for authorization but an really new to all of ...
1
vote
1
answer
154
views
Best Practices for Passing Custom Headers with Special Characters in RestSharp?
I'm working on a project where I need to send HTTP requests using RestSharp in C#. These requests require custom headers, some of which may contain special characters or non-ASCII characters, such as ...
0
votes
0
answers
53
views
Using .Net/RestSharp/Polly how do I get serialized body content before calling execute on the RestClient
I’m developing a vb.net application targeting .Net Framework 4.8 using RestSharp and Polly and I trying to gzip the request that is being sent.
My understanding is if I can get hold of the serialized ...
0
votes
2
answers
130
views
Sudden TLS/SSL RestSharp failure on Win7 comps
I have C# WPF net framework 4.7.2 app running which has been working for about 18 months on 1200 computers.
Just this morning I have had support calls as a number of computers cannot load our app.
In ...
0
votes
0
answers
37
views
Xamarin Forms with RestSharp Authorization Bearer
[The problem]:
The request works in Postman, however the server responded “Unauthorized” from mobile app request.
[The code]:
var options = new RestClientOptions(MyBaseEndpoint)
{
MaxTimeout = -1,
};...
0
votes
1
answer
548
views
Restsharp v110 update Rest Client
I'm looking to migrate to v110 of Restsharp (from v106).
All looks OK so far bar I'm unsure how to update the Rest Client once initialised.
We are running api automation and have an initial method to ...
0
votes
1
answer
396
views
How to add scope parameter to a Oauth2 token restsharp request
I'm trying to get a token from a given endpoint by using restsharp and client_credentials authenthication specifying a scope.
The token I get in response does not have the correct scope and the I use ...
0
votes
0
answers
367
views
Should RestClient of Restsharp be singleton and never disposed?
Restsharp documentation states "RestSharp is a wrapper around HttpClient".
Now, as it states in Do HttpClient and HttpClientHandler have to be disposed between requests? "the general ...
0
votes
1
answer
347
views
Using RestSharp, when an assertion is made that fails it is changing the response code to 409
I have code that submits a POST request and returned are headers, body and a 200 status code. I assert on the status code to make sure it returned 200/204/302, then parse the response body and headers ...
0
votes
1
answer
100
views
How to handle Mutliple Authtoken in RestSharp
I have a System endpoint which requires ClientID, SecretKey, Scope and grantType. I set the client-wide authenticator by assigning the Authenticator property of RestClientOptions.
Now I also have a ...