31
Views
10
Comments
[Multipart/form-data] Multi-Part form data in API
multipart-form-data
Service icon
Forge asset by Kilian Hekhuis

I am consuming an API accepting multi-part form data.

        

When passing the binary file as one of the parts from client side or file system, API is responding sucessfully. But when passing it by fetching the binary data from Outsystems DB and passing it, then it is not responding .

This is executed in the timer.
What could be the possible reason?

2024-12-02 13-16-47
Vipin Yadav

Hi Saurabh Sengar,

Please check the API trace log for both cases: when the call is made from the timer and when it's made from the client side. Also, compare the request parameters in the API log for both scenarios and note any differences.

Thanks,

Vipin Yadav


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Saurabh,

First, if you are consuming an API that wants Multipart/form-data, please do not use this asset but the built-in functionality. It's easier to use than this asset, and offers all the advantages of built-in functionality.

Only if you are exposing an API that accepts Multipart/form-data this asset should be used.

2021-11-19 13-48-33
Saurabh Sengar

Yes, i am consuming an API that accepts multipart/form-data.. 

But our current platform version doesn't match with the pre-requisites.

It's 11.18.1.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Right, I didn't realize people have this old versions :). You really should upgrade it, there's been a lot of critical security vulnerabilities fixed since then...

That said, you wrote "it is not responding". What do you mean by that? Do you get a time-out?

2021-11-19 13-48-33
Saurabh Sengar

Case 1-  When Binary file is directly passed from the client side of the application ##Success


Case- 2 When binary is fetched from the Outsytems DB 

, exactly the same payload as Case 1 attached screenshot. No Full Response


So the issue is coming when we are fetching binary file from the DB.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

I would say the problem is also on the other side of the API, as it's weird that that's the response if there would be something wrong with the payload. It's like it gets an empty payload, and decides that's A-OK.

Have you debugged the module to see what parts are added, and what the final message looks like before it is sent to the API? It should look the same whether a file is uploaded or fetched from the database.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

But there must be some difference, otherwise you can't explain why the API responds differently. You could consider saving the payload (by changing the code of the extension, either by saving it to disk if you are on-premise, are passing it as output then downloading), and binary compare the two payloads of the different situations.

2024-07-09 06-45-01
Adarsh

Hi @Saurabh Sengar ,

I encountered a similar issue a month ago and reached out to the team that exposed the API. Together, we debugged and found that the filename needs to include the extension as well. 

For example, it should be saved as "Filename.pdf."

Please check whether you are sending extension or not.


Please try this approach, and let me know if you need any help from my side. 

Thanks and Regards,

Adarsh Patel

2024-02-14 09-44-45
Omar Abd elkefi

Hello @Saurabh Sengar 

I have encountered the same issue, and this configuration did solve it

Im providing file name and binary from my outsystems database.

Regards

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