101
Views
14
Comments
Solved
How to use form-data API request ?Request is an Image , Response is a Json - POST
Question
Application Type
Reactive

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 ?

2025-02-04 10-17-42
Shreelakshmi N S
Champion
Solution

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

2022-10-12 15-20-13
K C S

Hi Shreelakshmi Shivaramu,

Thank you. Let me try now. Also, It is possible to check whether the API response in the Outsystems?


2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi @K C S ,

You can not test the API in outsystems. You can implement and check the result on runtime through browser.

Regards,

Shree

2022-10-12 15-20-13
K C S

Hi Shree,

Thanks. 

If possible can you provide me an OML pl. I'm getting connection time out error.

2025-02-04 10-17-42
Shreelakshmi N S
Champion

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.

Regards,

Shree

2022-10-12 15-20-13
K C S

Hi, 

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


API_1.PNG
API2.PNG
APIInput.PNG
Multipartdata.PNG
ScreenAPI.PNG
2022-10-12 15-20-13
K C S

Hi Shree,

Can you send me the full screenshot of this?



2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi,

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 


Regards,

Shree

2022-10-12 15-20-13
K C S

Hay shree,

I changed like this. But getting connection timed out. Any idea


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

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.

2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi @K C S ,

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.


Regards,

Shree

2022-12-05 07-28-20
Nihil Gujar

Hi, @Shreelakshmi N S 

Can you please tell me how I can add this relativePath?


UserImage.jpg
Kay Lun

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.

2025-02-04 10-17-42
Shreelakshmi N S
Champion
Solution

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

2022-10-12 15-20-13
K C S

Hi Shreelakshmi Shivaramu,

Thank you. Let me try now. Also, It is possible to check whether the API response in the Outsystems?


2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi @K C S ,

You can not test the API in outsystems. You can implement and check the result on runtime through browser.

Regards,

Shree

2022-10-12 15-20-13
K C S

Hi Shree,

Thanks. 

If possible can you provide me an OML pl. I'm getting connection time out error.

2025-02-04 10-17-42
Shreelakshmi N S
Champion

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.

Regards,

Shree

2022-10-12 15-20-13
K C S

Hi, 

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


API_1.PNG
API2.PNG
APIInput.PNG
Multipartdata.PNG
ScreenAPI.PNG
2022-10-12 15-20-13
K C S

Hi Shree,

Can you send me the full screenshot of this?



2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi,

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 


Regards,

Shree

2022-10-12 15-20-13
K C S

Hay shree,

I changed like this. But getting connection timed out. Any idea


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

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.

2025-02-04 10-17-42
Shreelakshmi N S
Champion

Hi @K C S ,

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.


Regards,

Shree

2022-12-05 07-28-20
Nihil Gujar

Hi, @Shreelakshmi N S 

Can you please tell me how I can add this relativePath?


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