You need to sign in to do that
Don't have an account?
Jugbeer Bhola
Multipart POST to REST
Hello, I have been searching, attempting to find a functioning example of how to POST multipart base64 attachments and associated parent documents to a third party service. I see pieces for just attachments and pieces for documents but nothing together.
An example would be to send an application (document) with attachments (resume, photo Id, pdf) to the 3rd party in a REST Post.
Does anyone have a working example of this? Don't know if I need to send the base64 attachmetns by themselves or within the body the request with the document.
An example would be to send an application (document) with attachments (resume, photo Id, pdf) to the 3rd party in a REST Post.
Does anyone have a working example of this? Don't know if I need to send the base64 attachmetns by themselves or within the body the request with the document.
To send an application (document) with attachments (resume, photo ID, PDF) to a third-party service in a REST Post, you can use the multipart/form-data content type to send the base64-encoded files as part of the request body. The approach would be
> Use Apex to convert the files to base64-encoded strings. You can use the EncodingUtil class to do this.
>Use Apex to create the multipart/form-data request body. The request body should include the document and attachment parts, each with their own content type and base64-encoded data.
>Use Apex to send the REST Post request to the third-party service. Set the content type of the request to multipart/form-data and include the request body in the request.
Example:
Related: https://salesforce.stackexchange.com/questions/24108/post-multipart-without-base64-encoding-the-body
https://stackoverflow.com/questions/65350640/to-upload-a-file-what-are-the-pros-and-cons-of-sending-base64-in-post-body-vs-mu
https://community.smartbear.com/t5/ReadyAPI-Questions/How-to-post-a-REST-with-Json-value-and-base64-encoded-file-as-a/td-p/178203
If this information helps, please mark the answer as best. Thank you