[Multipart/form-data] Call the API once to send a JSON format and binary content simultaneously
Forge component by Kilian Hekhuis
Application Type
Traditional Web, Mobile, Reactive, Service

Hello Outsystems support, recently I want to integrate using a REST API that uses "multipart" content-type with boundary input, as I believe this method is not supported natively by Outsystems. And therefore, we never use this method to call an API.

So with this API we have to send a two separate content; JSON formats and multiple attachments. The headers and specifications of the API are below

Is this possible to call the API once to send a separate content as above? What kind of approach or example that we have to do to meet this requirement?

Thank you

mvp_badge
MVP

 Aditya,

First, we are not OutSystems Support. Multipart/form-data is not a supported component, so it's up to the community members who put it in the Forge (which would be me :)) to support it.

At first glance, I'd say that yes, you can use this component to do what you want to do. The API specification is a bit difficult to read though, so I'm not 100% sure it covers everything.

sorry I've mistakenly referring as Outsystems support in this forge's discussion, a little bit of habit I guess :)) beside we are very thankful to have your contribution and support especially in this part

I have installed your demo for this component but there is no example for Boundary token/input. From my picture I've attached above, for the Boundary format were randomString_32_characters_12345. Not sure on how I do approach that requirement

also I want to ask for this "Content" parameter inside PartAdd node, is this a base64 format of the content or I have to use the binary data format for the attachments? Or this one is for the JSON formatted text?

Thank you

mvp_badge
MVP

Yeah, the documentation is a bit lacking, I should update it. However, there can never be a requirement about a specific boundary to use, as the multipart/form-data specification allows for any boundary, as long as it's unique within the entire payload.

As for Content, like the description of the parameter says, use it for Text content (which can be JSON). If you need to add binary data, use the ContentBinary parameter instead.

I see,

To clarify,  there is no specific requirement to use for Boundary format in the header of REST APIs. Then for the content parameter in PartAdd's server action node can be used to pass JSON formatted text. We will try to implement this method first and a bit of exploring.

Thank you Kilian

mvp_badge
MVP

Ok, good luck. If you have any more questions, I'd be happy to answer them, if I can.

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