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
Jon Simmonds 11Jon Simmonds 11 

Convert base64 files to binary for API calls

We need to call an API that has a Content Type of multipart/form-data which means that the body of the request needs to be split into individual sections.

Part of this request is a file that needs to be sent in a binary format.

These files are reciepts that are stored in Salesforce as Files which are Type Base64 (VersionData)

However we are struggling to understand how to convert the files from Base64 to binary for the API calls?

Any help appreciated.
SwethaSwetha (Salesforce Developers) 
HI Jon,
Does the post https://salesforce.stackexchange.com/questions/56899/salesforce-isnt-handling-base64-encoded-attachments-uploaded-via-rest-api help?

Also see https://salesforce.stackexchange.com/questions/306741/how-do-i-get-correct-base64-data-present-in-versiondata-field-in-contentversion

If this information helps, please mark the answer as best.Thank you