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
0
votes
0 answers

'authority' should be in Uri format Parameter name: authority while getting access token by passing "TenantID"

I am trying to add authentication to api call in Rest sharp version 108.0.2 error : 'authority' should be in Uri format Parameter name: authority I have upgraded the Restsharp version from 106 to 108 , Then here previously we are using HttpClient…
0
votes
0 answers

How do I fix this XML error in RestSharp that occurs in a Request Token?

I'm trying to make a Request Token to a Jira On premise server API that requires the use of OAuth.1a, I've been using the below C# code and I receive the error System.Security.Cryptography.CryptographicException: 'The provided XML could not be…
antland01
  • 41
  • 1
  • 3
0
votes
0 answers

C# .Net Framework Class Library proj - Newtonsoft.Json gives "The system cannot find the file specified..." error

The project is a Class Library which I want to use it from a Visual Foxpro application. Visual Foxpro is 32bit. .Net project: Target framework .Net Framework 4.7.2 Target Platform x86. Using Newtonsoft.Json and RestSharp I registered the DLL…
0
votes
1 answer

Get Thumbnail from FORGE API but received status code 202

I'm trying to get thumbnail from Forge API here https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/thumbnails/urn-thumbnail-GET/ ` I got it with Postman and axios successfully, and I tried it with RestSharp, HttpClient and…
RomCoca
  • 23
  • 4
0
votes
0 answers

A Class which uses RestSharp works if the calling program is built with .NET Core 3.1 but not if built with .NET Framework 3.5

The Assembly and both apps are built using VS2019 Visual Basic: I need to use .NET Framework to build a Windows app, because the program will be ran on some old, possibly XP computers, in some of the 50 private locations around the USA and Canada. …
RichG
  • 1
  • 2
0
votes
1 answer

RestSharp v108 Missing ConfigureMessageHandler for Mocking Responses in Unit Tests

I am reading the documentation for converting to v107+. I'm currently using v108. In the documentation, for mocking, it says to do this: var client = new RestClient(...) { ConfigureMessageHandler = _ => mockHttp }; But apparently v108 no longer…
stricq
  • 798
  • 6
  • 18
0
votes
0 answers

RestSharp response with http on https port ist cancelled by user

I am building an error handling for my rest application which uses RestSharp (Version 108.0.2) for the communication. Lets say the server accepts http-requests on port 6543 and https-requests on port 3456. When I now use http://myServer:3456 (which…
Marcel Grüger
  • 885
  • 1
  • 9
  • 25
0
votes
2 answers

How to check the rest empty response in dotnet

I am using RestSharp for API calling in dotnet core. I have one endpoint on which sometimes I am getting empty response {} and when there is data it returns me the data. I want to add this empty {} response check so currently, I am doing so. var…
0
votes
1 answer

How to write a generic restsharp method (separate)to set client, send request for any type and get the generic response back in framework development

I am new to C# and i am writing a test framework with Specflow,xunit and restsharp. My Step is as below When I make a request Then I should get a success 200 Here as you can see the second step is common step which can be…
amazo Tv
  • 3
  • 1
0
votes
1 answer

Get desired result while calling API using Postman but don't when using RestShart in console program

We are working on a project where our C# appliction is using 3rd party API (and we can't ask 3rd party for any changes). We are facing very strange behaviour that there is one end-point which requires few headers including 'date', when we call it…
S.ATTA.M
  • 409
  • 5
  • 10
0
votes
1 answer

After restclient execute method my request model is null web api

Client public BaseResponseDTO GetInvoiceInfo(InvoiceRequestDTO model) { _client.BaseUrl = new System.Uri(_serviceUrl + "/Invoice/GetInvoiceInfo"); _request.Method = RestSharp.Method.POST; …
0
votes
0 answers

Restsharp API call slow (4s) but same call on Postman is fast (13 ms)

I was using an older version of Restsharp (about a year ago!) and then updated to the newest version. (Current 108.0.2 installed). The call I'm running is to a local computer, to a third party API. If I run the call in postman, I get a 12ms…
GAngel
  • 1
  • 2
0
votes
0 answers

NuGet package RestSharp (version 108) gives error 'Method is not allowed'

We have upgraded the RestSharp NuGet package in our Application from v106 to version 108, and applied the migration recommendations as described here: RestSharp v107 Migration Guide, but somehow when a PostAsync is being executed in our application…
Martijn
  • 1
  • 1
0
votes
0 answers

System.Net.Http.HttpRequestException: 'Request failed with status code InternalServerError'

This exception is thrown when I need to call the Registry of my project and get all services displayed in client.It worked yesterday but dont know why its not working now.Can anyone help with me with this? This is my method to get all services to…
sd gopal
  • 1
  • 2
0
votes
1 answer

how to change dotnet core outgoing http request hostname from the default localhost

I am able to successfully send requests to a sandbox via postman, given by a provider following their specs (see images below) Successful request (see below) In order to do that, aside from the respective headers and parameters (see image 2) I have…
gustavexx
  • 25
  • 1
  • 5