48
Views
6
Comments
How to upload file in rest API

I want to pass or upload the excel file from UI to rest API to exceute one of my process
how do I that ?

2024-10-16 11-59-48
Nick Vandebriel

Hi Nikil,

You could just pass the excel as binary data in your exposed API and do the required logic in your action:

2024-10-12 12-11-20
Kerollos Adel
Champion
2019-01-07 16-04-16
Siya
 
MVP

@Nikhil Jagtap : What exact issue you are facing while invoking the REST API from client / screen action ? Is this REST API hosted by OutSystems or from other sources ?

2026-03-12 06-20-48
KUNDAN CHAUHAN
Champion

HI @Nikhil Jagtap,

There’s already a solution for the issue discussed. Please check out this link for more information.

https://www.outsystems.com/forums/discussion/56543/consume-rest-api-to-upload-file-in-outsystems-mobile/

Thanks,

Kundan

2024-10-18 05-19-58
Nikhil Jagtap

Thanks for the information.
I will check it out.

2021-10-09 07-57-44
Stefan Weber
 
MVP

There are multiple ways to upload a file to an exposed REST API. The most widely used way is to perform a multipart upload. The advantage opposed to the proposed solution above (just a Binary Data input) is that you are also able to get the filename plus optional additional data in a single request.

To parse a multipart post you would have to add a component to your factory like this one https://www.outsystems.com/forge/component-overview/4026/multipart-form-data-o11

The second way is to use a binary data only like proposed above. Without the filename you would have to apply other techniques to identify the MIME type of the binary data. Search the forge for magic numbers for a component that allows to identity the MIME type from a binary data only.

The third option is to convert the binary data on client side in a base64 string and send this along with additional json data to your API.

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