When utilising the RestSharp RestClient method, an error occurs.
My API uses RestSharp to call a REST API, and the code looks like this.
var testRequest = { My JSON Data} var clientResponse = new RestClient("....."); var callrequest = new RestRequest("....", Method.Post); string authHeader = "..."; callrequest.AddParameter("application/json", testRequest, ParameterType.RequestBody); callrequest.AddParameter("Authorization", "Bearer " + authHeader, ParameterType.HttpHeader); var response = clientResponse.Execute(callrequest); <---- //Red line showing here return Ok(response);
Error
I’m unable to run my software because of the red line. Could someone perhaps explain what the problem is?
Thank you very much.
Answers (1)
Add AnswerThank you Umang Ramani
Yes
Are you using the latest version of Restsharp ?