'Error showing while using RestSharp RestClient method
My API is calling REST API using RestSharp and Code looks like this
var runRequest = { Contains my JSON}
var client = new RestClient(".....");
var request = new RestRequest("....", Method.Post);
string AuthHeader = "...";
request.AddParameter("application/json", runRequest, ParameterType.RequestBody);
request.AddParameter("Authorization", "Bearer " + AuthHeader, ParameterType.HttpHeader);
var response = client.Execute(request); <---- {Red line showing under client}
return Ok(response);
Error
Because of that red line, I am not able to run my program. Can somebody please tell what the issue can be ?
Thank you
Solution 1:[1]
You are using the latest RestSharp version. All the sync methods were deprecated as RestSharp uses HttpClient under the hood, and HttpClient doesn't have any sync overloads, everything is async.
You can find a list of changed or deprecated members of RestClient in the documentation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexey Zimarev |

