Be Good & Do Good!

Salesforce Web service Callout Limits(Timeouts)

The following limits apply when an Apex script makes a callout to an HTTP request or a Web services call. The Web services call can be a Force.com Web Services API call or any external Web services call.

  1. A single Apex transaction can make a maximum of 10 callouts to an HTTP request or an API call.
  2. The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 60 seconds. See the following examples for how to set custom timeouts for Web Services or HTTP callouts.
  3. The maximum cumulative timeout for callouts by a single Apex transaction is 120 seconds. This time is additive across all callouts invoked by the Apex transaction.

The following is an example of setting a custom timeout for Web services callouts:

docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds

The following is an example of setting a custom timeout for HTTP callouts:

HttpRequest req = new HttpRequest();
req.setTimeout(2000); // timeout in milliseconds

2 Comments

  1. M shah

    Hi Chirag ,

    I am confused over timeout logic. Need your response asap.

    Lets suppose I am making call out to post data to web service and set timeout 120 seconds,
    1# I thought , that the 120 seconds starts when the post starts, so that if the post would take more than 120 seconds, then Sales force will timeout and the post will not complete. Is this correct?

    or

    2# this meant that after the post completes, it would wait 120 seconds for a response from the web service.

    Please let me know .
    Thanks

  2. Priyanka

    hi Chirag ,

    Can you please help me out with “What is exact no of HTTP
    callouts we can make in 24 hours?”

Leave a Reply

Your email address will not be published. Required fields are marked *