Solved

RESTClient Code not working in 2023 R2

  • 20 December 2023
  • 2 replies
  • 136 views

Userlevel 4
Badge

Hi Team,

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

icon

Best answer by praveenpo 20 December 2023, 12:11

View original

2 replies

Userlevel 6
Badge +3

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);

Userlevel 4
Badge

Hi @praveenpo ,

Thanks let me check and try this.

 

Regards,

Ramya

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved