Notifications
Clear all
Aug 18, 2021 1:53 pm
How to take some action if there in no response, server timed out in a rest api call?
1 Reply
Aug 18, 2021 2:04 pm
Figured it out. Use the following code:
req.setHeader('Content-Type', 'application/json'); Http http = new Http(); HTTPResponse res; try { res = http.send(req); } catch (System.CalloutException e) { // add required action here, like calling the rest api again if need. }
Just put it in a try catch block and use the System.CalloutException