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

What is the best method to receive 5- 10 files of 5 MB each from an External System

What is the best method to receive 5- 10 files of 5 MB each from an External System. These file will be attched to Opportunity record, which is already existing in the Salesforce system.
The external system will not send more than 50 Opportunities per day.

Following is the limitation from Salesforce
Maximum size of callout request or response (HTTP request or Web services call) in SFDC is 6 MB for synchronous Apex or 12 MB for asynchronous Apex ,

Should the external system use our OOTB REST API 
For Attachment
For Files

We are using files, so ContentVersion looks very close to it, than Attachment

What would be best way without encountering any limitation. 

Kind Regards,
Rohini H
Hi Rohini,

If external system can use our API then I suggest go with that. As in Salesforce we have limits(You have already mentioned) which might give us trouble if in future we want to increase the size. So to avoid that issue its best if we use standard APIs.

If this answer helps you, please mark it as accepted.

Tushar Sharma
Thanks, Tushar.
It works fine for Composite Request REST API when transferring files with parent record, but using non-multipart, it has a limitation of 37.5 MB of base64–encoded data, so, was trying the option to create/update a file using multipart as mentioned in 'Inserting a ContentVersion'  in  link .

But, on executing the command in workbench, PDF files gets uploaded in Salesforce, but I cannot view it. It always says 'Failed to load PDF document.'
Say, to insert a new version of the file using workbench
I set the following in the Request Header section 
Content-Type: multipart/form-data; boundary="boundary_string"
Accept: application/json
In Request Body
Content-Disposition: form-data; name="entity_content";
Content-Type: application/json
"ContentDocumentId" : "069D00000000so2",
"ReasonForChange" : "Marketing materials updated",
"PathOnClient" : "Q1 Sales Brochure.pdf"
Content-Type: application/octet-stream
Content-Disposition: form-data; name="VersionData"; filename="Q1 Sales Brochure.pdf"
Binary data goes here.

What am I missing to get that message in Workbench for PDF or xls file.
For text file, I had to include 'Content-Transfer-Encoding: base64;' before typing in binary data, else the complete encoded string was visible when viewing the file in Salesforce.

Kind Regards,