236
Views
7
Comments
Solved
Consume Rest API which takes a binary file as input
Question

Hello all,

I could see many old articles around this topic similar to the below one that uses  a forge component to consume web services with binary data as input. I also read in the below article that this feature is now available out of the box in the platform itself. Can someone help me with the steps needed to consume a rest api which takes only a file as input? I tried with the out of the box feature but getting 'Internal server error 500' as response.

https://itnext.io/consuming-a-multipart-form-data-rest-method-with-outsystems-c466e404118d

2025-10-09 15-40-22
Craig St Jean
Staff
Solution

Hey Krishnna,

To use multipart as a REST POST like this, you need to change your data type of your input parameter from `Binary` to `RequestPart`. ServiceStudio creates this structure automatically for you.

Once you change the type, you can set the name ("file" based on your screenshots), the part binary data, and you must also set the filename of the binary part.

I hope this helps!


https://success.outsystems.com/documentation/11/extensibility_and_integration/rest/consume_rest_apis/consume_one_or_more_rest_api_methods/consuming_a_rest_api_with_a_multipart_or_form_data_method/

2024-04-05 11-04-57
Krishnnambal
 
MVP

Please find below the steps I followed:

1.  Tested the API in Postman and it's working fine.

2. I tried consuming it from OutSystems. Since it takes a binary file as input, I left the 'Request' example empty and provided only 'Response' body as example.

3. When I clicked on Finish, the following got created.

4. I manually added an input parameter of type binary data to the API method to get the document as input and changed the 'Send In' property to 'Body'

5. I changed the 'request Format' to 'Multi-Part/FormData'

After these steps, when I tried consuming the API it says 'Internal Server Error 500'. Please let me know if I am missing anything here.

2022-12-28 12-37-38
Luis Dinis

Hi  Krishnnambal S,

First of all can you check which version of the platform server you are using? Because in the platform server 11.19.0 it's already supported input as binary data:


Is is possible the owner of the method change the input to string and be able do receive base64string?
In this case you can only convert binarydata to Base64string...

2024-04-05 11-04-57
Krishnnambal
 
MVP

H Luis,

Thanks for the response.

I am using version 11.21.0. My platform server version supports 'Binary Data'.

It wouldn't be possible for us to change the input type of the API. 

Is binary data different from PDF?

UserImage.jpg
vijay r

Hi @Krishnnambal S ,

You can try below method if you require to Consume Rest API which takes a binary file as input,

You can try Request Format as Binary , it will accept if you can give Request as Binary data type and Send in property of request to Body.

I have not tried with request format as Multipart/Form-data.

Thanks.

2025-10-09 15-40-22
Craig St Jean
Staff
Solution

Hey Krishnna,

To use multipart as a REST POST like this, you need to change your data type of your input parameter from `Binary` to `RequestPart`. ServiceStudio creates this structure automatically for you.

Once you change the type, you can set the name ("file" based on your screenshots), the part binary data, and you must also set the filename of the binary part.

I hope this helps!


https://success.outsystems.com/documentation/11/extensibility_and_integration/rest/consume_rest_apis/consume_one_or_more_rest_api_methods/consuming_a_rest_api_with_a_multipart_or_form_data_method/

2024-04-05 11-04-57
Krishnnambal
 
MVP

Thanks a lot, Craig! This fixed my issue. Best wishes.

2023-07-14 10-41-01
Gayathri Hariharan

Hi,

Although the input parameter is set as a RequestPart structure, the issue still persists. I do not want to use the Forge component. Is there a better solution? Please let me know if I am doing something wrong. 

Thanks!



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.