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
nileshjnileshj 

HTTP POST request payload limit

Hi,

I am facing an issue while making HTTP POST request on remote site for uploading file.

On HTTP req.setbody() there is a limit of 3 mb.

So how can I upload files larger than 3 mb??


I have noted down the request and http call for the same

 

     

  sUrl = 'https://upload.box.net/api/1.0/upload/'my_auth_token/598054528';


        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setHeader('Content-Type','multipart/form-data;boundary='+boundary);
        req.setHeader('Content-Encoding','base64');
        req.setEndpoint(sUrl);
        req.setMethod('POST');
        req.setTimeout(60000);        
        req.setBodyAsBlob(EncodingUtil.base64Decode(blobObject));

        response = h.send(req);

 

 

Any pointer on this will be helpful.

 

Thanks,

Nilesh.

sfdcfoxsfdcfox

You cannot exceed the payload limit; this limit is in place to ensure equal access to resources for all users of the platform. However, you can choose to call setCompressed on the HttpRequest class, which may allow files larger than 3MB to be uploaded (but not by much, I would presume).