I have created a flow for retrieving html document along with metadata and some pdf attachment from a third party and then uploading the same to another third party. Data retrieval part is working fine but while uploading we are facing issues. For all this we are using HTTP connector.
Issue: For file upload we are using multipart, when whole body syntax is added directly to the HTTP body section it is working fine and the file gets uploaded, but when we try to create a variable and added all the multipart JSON syntax to the variable and used this variable reference in the HTTP request then we are getting 415 error.
There are multiple attachments for each document for which we need to apply a loop and append all the content to the variable and then pass it to the HTTP request. Seems like it could be due to some additional escape chars which could be added to the JSON and in HTTP request it is considered as invalid JSON, also replacing the escape charter is not making the JSON valid.
Kindly suggest as this is very crucial and we are very close to the deadline.
Thanks in advance,
Aakash Rajput
Hi Sandeep,
Thank you so much for your quick response.
Your suggestion helped me in fixing the issue and now the flow is working like a charm.
Based on your suggestion I have made the below changes to my steps:
- Instead of passing the variable in HTTP body I have created a compose object for each item.
- Converted compose string to Json.
- Appended all the items in Array.
- Passed the final array in the multipart body.
And below is the HTTP body.
Thanks,
Aakash Rajput
Hi There,
Instead of saving the whole HTTP request body in a variable, only store the data from the attachments in an array variable. Each item in the collection should be an object with the Content-Disposition, Content-Type, and body for each attachment. Set up a "Compose" action that lets you make the JSON string for each part. In the 'Compose' action, go through the array of files and add each one to the string. Instead of using a variable for the body in the HTTP request action, use the result of the 'Compose' action. In the HTTP request headers, don't forget to write "Content-Type: multipart/form-data; boundary=your-boundary." The limit string should be the same as the one used for the "Compose" action.
Here you can see your boundary - https://stackoverflow.com/questions/3508338/what-is-the-boundary-in-multipart-form-data
Make sure the format of the multipart content is right, especially the headers for each part and the structure as a whole.
Please give kudos and mark as solution if it helps.
Thanks,
Sandeep Mishra
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2