I have upgraded my REST API code from 2022R1 to 2023 R2. As per latest RESTSharp DLL I have modified the code and able to compile. but I’m not getting response for my Asynchronous GET Method.
Below is the code and Error message for your reference. Please help me to rectify this issue.
Error Message: Object Reference Error.
Regards,
Ramya Krishna
Best answer by praveenpo
hi @ramya15 ,
There are few changes in the Rest Sharp starting from v107 version. Please go through the below link and adjust your code based on the changes. https://restsharp.dev/v107/#reference.
Below is the sample code with POST which is working in 23R2. you refer this too.
var client = new RestClient(); var request = new RestRequest("<Url>", Method.Post); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Authorization", "Bearer pKfhKMxMrLsKcKvpMRi2dSbQPOzpxRdO"); var body = JsonConvert.SerializeObject(GetRequestObject()); request.AddJsonBody(body); RestResponse response = client.Execute(request);
There are few changes in the Rest Sharp starting from v107 version. Please go through the below link and adjust your code based on the changes. https://restsharp.dev/v107/#reference.
Below is the sample code with POST which is working in 23R2. you refer this too.
var client = new RestClient(); var request = new RestRequest("<Url>", Method.Post); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Authorization", "Bearer pKfhKMxMrLsKcKvpMRi2dSbQPOzpxRdO"); var body = JsonConvert.SerializeObject(GetRequestObject()); request.AddJsonBody(body); RestResponse response = client.Execute(request);