Hi
How to use form-data API request ?Request is an Image , Response is a Json - POST
The postman screenshot is attached for your reference. I tried Multipart-Formdata Forge component But not able to get the result. Tried various options but to no avail. Any one can share the OML ?
Hi @K C S ,
I have used the multipart form data forge component and done the API integration in one of my projects. Please follow the below steps.
1. Use forge component - Multipart/form data
2. Use MultipartFormDataCreate action from the forge component before calling your API
3. Do the configuration as below for the MultipartFormCreate action. Filename should be same as the filename on the upload widget
4. On the API ContentType and Request inputs map it with the output of MultipartFormCreate action.
Hope this helps!!
Regards,
Shree
Hi Shreelakshmi Shivaramu,
Thank you. Let me try now. Also, It is possible to check whether the API response in the Outsystems?
You can not test the API in outsystems. You can implement and check the result on runtime through browser.
Hi Shree,
Thanks.
If possible can you provide me an OML pl. I'm getting connection time out error.
Hi,
Sorry I can not share the oml as the API is confidential. Can you please check the logs on service center and share it here so that we can see where it is going wrong.
No issues. Thanks. I have attached the screenshots, which I have used.Can you pl check this.
You can see postman request in the question.
Thanks
Can you send me the full screenshot of this?
In the below place, for the request please assign MessageBinary output of the MultipartFormCreate action. Cookie is for our requirement, In your case it is not required.
And for the content type on the MultipartFormDataCreate set content type as your file type, for example: png
Make these changes and please check
Hay shree,
I changed like this. But getting connection timed out. Any idea
Hi K,
A connection time out has nothing whatsoever to do with the format in which you send the data. That's a problem on a whole other level. Most likely there's a firewall blocking things, or you have specified the wrong URL. Solve that problem first, before trying to get the multipart/form-data working.
This happens since you are uploading a file to the API and which would take some time to process. To solve that, wherever you are calling the API wrapper i.e., your server action inside the logic is done, define your own server request timeout for the server action. In my case I have defined 5 minutes i.e., 300 seconds. By default it will be (Module Default Timeout), clear that and give 300.
Hay Shree
THanks !. It's working
Hi, @Shreelakshmi N S
Can you please tell me how I can add this relativePath?
Have you tried this forge to see if it fits your case?
https://www.outsystems.com/forge/component-overview/13022/multipart-form-data-uploader
there's an server action which allow you to upload the file directly to a specific URL, and return a text response with status, not sure if it's okay to handle your case.