Post Closed
[Multipart/form-data] Sending an image with REST using Multi/Form-Data forge component
Forge component by Kilian Hekhuis

I am trying to use Multipart/form-data to send an image in a REST API request. 

The Component a URL property that I fill in with my API link. It also has another field for the binaryData that I fill in with my image.content. 

The problem is that I don't know where to put the key for the content value to use it in the API and access the image content.

How can I do this?


Hi Omar,

The specification for the API should describe all the details like that. This component allows you to send a multipart/form-data message, but how non-binary content is added depends on the API. Some APIs have a single part that contains JSON, others have one part per data item, yet others use header parameters, or URL parameters.

I want to send only binary data (The image) but I don't know how to retrieve it on the server side. 

Like, for any parameter, there should be a parameter name. What is the parameter name for the image I am sending here? 


Hi Omar,

You say you want to send binary data, but then write you want to retrieve it. If you are sending and receiving using OutSystems REST (so you are both exposing and consuming an OutSystems REST API), you shouldn't use this component. Multipart/form-data is to be used only in case you are consuming a 3rd party REST API and you need to use multipart/form-data.

As for your question, it really doesn't make sense to me. "For any parameter, there should be a parameter name" - what parameters are you talking about? "What is the parameter name for the image" - why should an image need a "parameter name"?

I think there is a misunderstanding now. 

I will re-explain everything once more. 

1. I have created an API that accepts POST requests with a parameter: "image"

2. The API adds the image to AWS storage and returns a response with the image link in AWS

3. I have tested the API with postman and sent the image and the API is working successfully. Now I need to do what Postman is doing using outsystems

4. In outsystems, I assume that I should be using REST API to send a Post Request to the API I have created. So, I did this but found out that outsystems only accepts JSON parameters to be sent using REST API 

5. I found Multipart/form-data forge component which I think will allow me to send the image to the API

6. To do the same as what Postman does, I have to send the image with the key "image" as when I try to access the image in the server side I check for the POST parameter "image".

My problem is that I don't know how to do this using the Forge Component.


Hi Omar,

"I have created an API" - using what development tools? What kind of API is this? You talk of a "POST request with a parameter", but POST is an HTTP method, and doesn't have a "parameter". POST requests have a URL, a header and a body, and the body consists of raw data, not of "parameters". So what kind of "parameter" are we talking about?

As for "[I]  found out that outsystems only accepts JSON parameters to be sent using REST API" - this is not true. You can sent JSON, Form URL Encoded, Binary or Plain Text in the body:

I have done the following:

1. Created a REST API POST request to the desired url

2. Added contentType field with a value of 

"multipart/form-data; boundary=Vivek"

3. Used BinaryConcat and concatenated the following:


TextToBinaryData(NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + UploadCacheTable.List.Current.UploadCache.Filename + """" + 



4. Then, used BinaryConcat and concatenated the result of the previous with the following: 


Now, when I am invoking the request, I get:

500 Internal Server Error


Hi Omar,

Please answer the questions I have asked above, I cannot help you if you do not know what you have done. It seems you are not responding at all to what I've written there.

In the example above, you are clearly not using the multipart/form-data Forge component, but trying to create your own multipart/form-data payload.


I am consuming a Rest API to upload any type of file (pdf, image, text etc)

1. I created a parameter with datatype Binary

2. I am using your forge component for making parts (name, type, description) and file Binary

3. I am passing the messagebinary in the content

the file gets uploaded but with empty content, blank file.


Hi Chan,

Please create a new topic, as your question is not related to the original one.