8

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);
    }
3
  • Please do not use any community tags unless you are actually asking questions related to the Communities feature.
    – Adrian Larson
    Commented Jun 2, 2017 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
    Commented Jun 2, 2017 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
    Commented Jun 2, 2017 at 12:05

1 Answer 1

15

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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .