Hi All,
I am trying to consume a rest api post method and it is expecting a xml file as input in the request body. In postman, there is an option where we can upload the file in the request body itself but in OutSystems I couldn't find one such way. I came across a column (Using Low-Code to Consume a Multipart/Form-Data REST Method) )by Kilian Hekhuis where he has mentioned instead of just the content type, a client (like a browser or REST consuming app) sending multipart/form-data sets the HTTP content type to “multipart/form-data,” but it also needs to specify something called a “boundary.”
How can we create a boundary and once the boundary is created, do we need to specify it in the request body just like in the image below.
Hello @Lincy Thomson
You can find some components in the forge that will help you with uploading multiform data, here are a few :
Multipart/form-data
Multipart/Form-Data Uploader
Hope it helps!
Paulo Rosário
Paulo,
Those components shouldn't be used if one hasn't tried the native solution yet! (And even then, only when one knows what one is doing.)
Hi Lincy,
You are thinking too low-level. The article I wrote describes what goes on under the hood, but you shouldn't be concerned with things like boundaries. Since I wrote that article, OutSystems has added multipart/form-data natively to its REST API consume (as noted on top of the article). Please check the official documentation and follow the steps there. It should allow you to consume the REST API and add the XML file to the request. If you somehow still can't successfully send the file, please report back here so we can further help you.