I am downloading ContentVersions through Salesforce using Rest API. I have submitted several file requests and downloaded.

After downloading, an observation was that the ContentSize field in ContentVersions does not correlate with the downloaded file size.

For example, I had a file that has ContentSize of "1,329,401,752" but when submitted or downloaded through Curl request, the file size on disk/actual size is "1,170,964,557 bytes". How is this possible? This was not synonymous with smaller files < 700 Mb where the content size does match. Has anyone had an issue with downloading files using rest api for larger files?

Edit: Found out that there is a Rest API timeout in Salesforce for retrieving the responses. Salesforce shuts down the response after the timeout and there are no header responses. However, the http might throw chunkedencoding exception or truncated chunk exception. The default timeout is 10 minutes. Have to call Salesforce support to extend the timeout for Rest APIs. It seems that there is no way to configure the timeouts through Rest APIs or even through Salesforce web interface.

Your Answer

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

Browse other questions tagged or ask your own question.