3

What is the default timeout for httpRequest. I have gone through this doc . But could not find the default timeout.

public class HttpCallout{
    @Future(callout=true)
    public static void getContent(String url){
        Http h = new Http();

        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        req.setTimeout(2000); // What is the default if I am not adding this code.

        HttpResponse res = h.send(req);
        String response = EncodingUtil.urlDecode(res.getBody(),'UTF-8');
        System.debug('***response****'+response);
    }
  • Please do not use any community tags unless you are actually asking questions related to the Communities feature. – Adrian Larson Jun 2 '17 at 11:54
  • I typed salesforce and It brings up community. dint think noted that is for cummunity in salesfroce. I took it general meaning .I will pick the right one next time. Thanks for the guidance – bharath Jun 2 '17 at 12:00
  • You don't need to let the rest of SFSE know your question is about Salesforce. It's the Salesforce Stack Exchange, so that information is 100% redundant. Either that, or your post is off topic. – Adrian Larson Jun 2 '17 at 12:05
10

From documentation:

The default timeout is 10 seconds. A custom timeout can be defined for each callout. The minimum is 1 millisecond and the maximum is 120,000 milliseconds.

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.