Rest WebService BinaryData Request

Rest WebService BinaryData Request


I'm consuming a REST API, with a method 'Post' to do upload of a file. On the post I send two string as request on URL, and on the Post Data  is needed to be sent a File.
The unique information I have got about that Post Data is that's a 'multipart/form-data' content-type.

Someone can guide me to the way to send the RequestFile?
Can you get an example of use for that REST API ?

I don't believe the OutSystems Platform will be able to encode the file in multiform/form-data automatically for you, so you'll likely have to create an extenstion that takes a binary file and returns a multipart/form-data encoded .

What the OutSystems Platform currently supports (automatic encoding for you) is JSON and application/x-www-form-urlencoded. Other than that you'll need to define the output type as text or binary data and create the request yourself.

You can check here for a more detailed discussion on what multiform/form-data is.

In my personal opinion, multiform/form-data is more for forms and not very RESTy ...


The Box Connector has an example of it.

There are 2 options:
  1. With the OnBeforeRequest or OnBeforeRequestAdvanced callback and setting the encoded body.
  2. Before the call instead of just passing the binary as input fo the necessary encoding (this is the one done in the Box component example)
Also you will need to set the Content-Type, notice how it is done in the Box Connector with the Input set to "Send In: Header"

João Rosado
Hello, I'm working with Tiago and we have been trying to consume the REST API based on the Box Connector as suggested but we are still not able to do it.
We were able to succesfully upload the file by the chrome REST extension.
The Error we get on Outsystems is the same error that we get on Chrome if we do not send any file.
There is a sample eSpace attached to show what we are currently doing.
Any ideas?
Kind Regards