function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ManoharSFManoharSF 

Rest API delay response

Hi there,

 

How can I delay the response for an REST API Request?

 

Thanks

Manohar

sfdcfoxsfdcfox
This question is awfully devoid of information. What exactly are you attempting to do?
ManoharSFManoharSF

Sorry was in hurry to log off..

 

Here's the situation,

 

I have external partner that uses REST API based call to our ORG to get some info. Based on data provided by the partner, we do a HTTP callout to an external system to  get some other data. So before I could get the response back from the external system, my API is responding back to the partner with empty JSON. 

 

So I am trying to delay the response back or may be hold off until I get all the data from external system. So trying to see what are my options?

 

Thanks for trying to help,

Manohar

 

 

 

sfdcfoxsfdcfox
Apex Code does wait on the other system, but not indefinitely. You can increase the wait time up to 120,000 ms by using HttpRequest.setTimeout(Integer). If the other system requires more time, you cannot access them in Apex Code. You would need to work with the system you are calling to make their responses faster.
ManoharSFManoharSF

But that doesnt work in RestContext. or is there a way to make it work?

sfdcfoxsfdcfox
How are you trying to set the timeout? Code would be nice.