Web request API multipart/form-data

Does EM support multipart/form-data? I know this setup works in PowerAutomate, I’m struggling to get it to work with EM.

{“type”:“RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content or more validation errors occurred.”,“status”:400,“traceId”:“00-e9cef85f695788bd5ace1178bbf0520e-ab9d2b65c498a316-00”,“errors”:{“”:[“Failed to read the request form. Missing content-type boundary.”]}}

image

image

Hi @nicktagz

The WebRequest/IterateWebRequest actions support the multipart/form-data content type.

Just change the Body type to the File (multi-part).

Seems that the expected field name for the file is FileName. However, check this with the API documentation.
You should enable the Additional parameters to send a form with a file. And fill out the form accordingly.

Also, you may set the Content-Type header. However, in the case of multipart file upload, this must be an actual content type (like application/pdf for the .pdf files, or application/octet-stream). But this is optional, and it depends on your API.

A preview mode (opened when the Show Preview button is clicked) will show a near-to-real request body.


image

Hm. Any error message?
Also, please provide a link to the API documentation.

I’m going to ask the developer for documentation on the API.

{“type”:“RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content or more validation errors occurred.”,“status”:400,“traceId”:“00-f1d30af28f89b7e03e92678e18fa5a41-c3a36f5e0758cf69-00”,“errors”:{“”:[“Failed to read the request form. Missing content-type boundary.”]}}

To check.
When you press Show Preview, does the preview contains Content-Type multipart/form-data and boundary?

Try to change WebRequest:

  1. Rename the Field name to File.
  2. Add another form field, FileName. And set it to the file name.
  3. If it still not work, try to add double quotes to the field names (screen 2)
  4. Try to remove the Content-Type header


Thank you, that worked. The primary Field name needed to be “File” and filename as an additional parameter. Appreciate the help!

1 Like