How to convert a System.FileDocument to binary?

Hi Everyone,   I am trying to send a System.FileDocument to an external API via REST call through POST request. The request body should be Form-data as the API accepts only form-data request(see screenshot). So the request should be sent in string<binary> format. How should I achieve this using a Javaaction for this conversion?   Thanks in advance!
2 answers

Hi Chandana,


Most APIs use Base64 as the encoding/decoding (check the documentation). 


The JA Base64Encode will transform your binary (as input) to an encoded String, to be used in your form.


If still stuck, leave the API description in the comment, so I can guide you more.


Go Make It.


System.FileDocument is already a BLOB which means its already a Binary.


I would suggest to create a Java action to call this webserivce and implement below logic to submit both form and file. 


If it is only file, use