Multipart with MIME function


I am trying to send a multipart (json string + pdf file, HTTP request POST) through, with the function MIME, and I get a 415 response.
I’m guessing I have one of my headers wrong or the coding before the “toStream” is not right, but I can’t find were (the pdf file is correctly decoded). I read every single forum I found, try all the solutions proposed, and nothing worked.

I’m getting the pdf file in a base64, and using a token as authorization.

So here’s my flowservice :

Here’s my requestInput that I see at the end of the flow :

Here are my two “parts” with the corresponding headers, plus the main header :

And here’s my output, that makes me wanna cry :

And beautiful postman, where everything works:


Please, do not hesitate to ask me for more info, I’d be pleased to answer.


OK so If I get it right, you have:

  • a Integration REST API
  • a flow service that is invoked through one method of this API, which takes multipart content in input (a binary file + a json document)
  • and within this flow service you’re trying to post the document by making another HTTP call to a third party service

For your screenshots, it’s the “third party” service (called within the flow service) that returns the HTTP 415.
Which service are your trying to post your document to?

Postman returns HTTP 201 because you don’t trap the HTTP 415 error in your implementation (the HTTP connector doesn’t throw an exception for such a HTTP 4xx error.)

Can you post an export of your flow service, if there’s nothing confidential in it?
Having the Swagger / OASv3 spec that’s on top of this flow service would also help, as well as screenshots with your API config in Integration.

Hello @karen.ld ,

Please find the attached sample for your reference on posting MIME data. (12.1 KB)

Also please share your export of flowservice and also postman collection will check it out.(is possible).


Hi Bharath,
Thank you for the sharing, bet my version of doesn’t seem to recognize the flow services, so I can’t import it.

Saddly, I can’t update my project either as it’s confidential information from my client :confused:

@Stephane.TAILLAND_emp So I’m trying to post it on my clients final application. I’m trying to create a session in this flow service. Here’s my connector (I just added the right URL in it, nothing else changed from the default one)

The 415 comes from the endpoint as the client told me that his logs show an attempt of a file transfer in the wrong format.

The Postman test case you mention here, it’s one that directly calls the backend to upload the file, without going through, is that it?
And you’re trying to do exactly the same with the HTTP connector in the flow service?

Here’s what I assume you’re trying to do:
First StringToStream: you have a hard coded base64 stream regarding your file
decodeBase64: you decode it to have binary content
Second StringToStream: you create a stream from this binary content
Saygotoken: you get the token to call your backend
And then you encode your multipart request and make a call to the backend

Just trying to put all the pieces together, but from what I see it shouldn’t be too hard to reproduce what you’re trying to do, even if you’re not willing to share your code (for reasons that are 100% understandable.)

Something that would really help: the raw HTTP request and response of your Postman test case. Just remove the URLs and tokens (and anything else you think is confidential) from it. This is going to tell us without any ambiguity what your backend expects.

HTTP 415 indicates an unsupported media type, and looking at your screenshots I see a plausible explanation.
In the “CreateMimeData” step, ensure you pass these two headers in the input mimeHeader document:

  • a Content-Type header that has the value “multipart/form-data”
  • a Accept header that has the value “application/json” (you currently have “application/json, multipart/form-data”)
    Not sending the Accept header at all could also work (in your Postman request it’s set to /.)

Your two parts look correct.

@Bharath_Meka1 , there’s an issue in the flow service you’ve posted, you’re sending the same Content-Disposition header value for the two parts. Other than that, your sample is very helpful!

Hello @Stephane.TAILLAND_emp ,

I finally got the answer. I ended up doing it as I started to do it at the begining: in a workflow. The original problem I had with the workflow is that it didn’t recognize my output, so we “force” it to read it by using the WriteFile function, and sending the parts as files with the extention in the namefile (.json and .pdf). Another blocking point was in the response: we only need to map the object, as the text (string) doesn’t come out in an acceptable jSon string.Here I send the screenshots of my work-flow, it might help somebody in the futur.

Thank you very much for the help!!!