726
Views
24
Comments
Solved
Consume Rest API to upload file in outsystems mobile
Question

Hello Team ,


I am able to call api from postman as post method for uploading file into server.

But when i am consuming rest api in outsystems .I am not getting, how to set data in form-data .

I can only set send as body to input parameter.

I have attached an image of postman for reference.

Can anyone tell me how to test this api on outsystems platform.


 

APIs.PNG
2019-03-18 10-26-38
Jeroen Vormer
Solution

Hi Vivek,

you have to pass all your form data as binary because you have to also upload a file content.
Every form-data should start with a boundary which should also be specified in your header:
Your header "Content-Type" should be for example: 

SyntaxEditor Code Snippet

"multipart/form-data; boundary=Vivek"

Then each form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""" + <formData field name (key)> + """" + 
NewLine() +
<field value>


In case of a file the form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + <filename> + """", "") + 
NewLine() +
<file content (binary)>

All formdata text can be changed to binary using TextToBinaryData (from the BinaryData extension).

The all data should be concatenated using BinaryConcat (from BinaryConcat extension).
You can use the result of this concat in your request input parameter BinaryData in body).
In this request you have to use also the header mentioned above (multipart/form-data; boundary=Vivek).

This boundery also should be on the bottom of the total request (as binary) like:
--Vivek-- (including the dashes)


Obviously the response is depending on the API you're using....

I've sent an OML by email you can use for the particular API you are using.

Best Regards,
Jeroen



2020-02-10 17-36-40
Eruel Castillo

Jeroen Vormer wrote:

Hi Vivek,

you have to pass all your form data as binary because you have to also upload a file content.
Every form-data should start with a boundary which should also be specified in your header:
Your header "Content-Type" should be for example: 

SyntaxEditor Code Snippet

"multipart/form-data; boundary=Vivek"

Then each form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""" + <formData field name (key)> + """" + 
NewLine() +
<field value>


In case of a file the form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + <filename> + """", "") + 
NewLine() +
<file content (binary)>

All formdata text can be changed to binary using TextToBinaryData (from the BinaryData extension).

The all data should be concatenated using BinaryConcat (from BinaryConcat extension).
You can use the result of this concat in your request input parameter BinaryData in body).
In this request you have to use also the header mentioned above (multipart/form-data; boundary=Vivek).

This boundery also should be on the bottom of the total request (as binary) like:
--Vivek-- (including the dashes)


Obviously the response is depending on the API you're using....

I've sent an OML by email you can use for the particular API you are using.

Best Regards,
Jeroen



Hi Jeroen,

Can you also send me the OML for this? I have the same problem. Thank you!

Email : castilloeruel@gmail.com

Regards,

Eruel


2019-03-18 10-26-38
Jeroen Vormer

Eruel Castillo wrote:

Jeroen Vormer wrote:

Hi Vivek,

you have to pass all your form data as binary because you have to also upload a file content.
Every form-data should start with a boundary which should also be specified in your header:
Your header "Content-Type" should be for example: 

SyntaxEditor Code Snippet

"multipart/form-data; boundary=Vivek"

Then each form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""" + <formData field name (key)> + """" + 
NewLine() +
<field value>


In case of a file the form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + <filename> + """", "") + 
NewLine() +
<file content (binary)>

All formdata text can be changed to binary using TextToBinaryData (from the BinaryData extension).

The all data should be concatenated using BinaryConcat (from BinaryConcat extension).
You can use the result of this concat in your request input parameter BinaryData in body).
In this request you have to use also the header mentioned above (multipart/form-data; boundary=Vivek).

This boundery also should be on the bottom of the total request (as binary) like:
--Vivek-- (including the dashes)


Obviously the response is depending on the API you're using....

I've sent an OML by email you can use for the particular API you are using.

Best Regards,
Jeroen



Hi Jeroen,

Can you also send me the OML for this? I have the same problem. Thank you!

Email : castilloeruel@gmail.com

Regards,

Eruel



Hi Eruel,


i've just sent you the oml by email.


Best regards,

Jeroen

UserImage.jpg
Shishir Shetty

Thanks for posting your answer. Can you send me the OML at this address: shettys@mskcc.org? 

UserImage.jpg
Omar Diaa

Can you send the OML file to omardiaa500@gmail.com?

UserImage.jpg
Daniel Breia


Hello Jeroen, could please send the oml file to this email daniel.breia@redshift.pt or just post a comment with the file? Thank you for your help.

UserImage.jpg
Rafael Ceballos

Hi I would like if possible to receive the OML  by email please to rceballos@axosbank.com please, I am stuck on this too

UserImage.jpg
Sakthipriya B

Hi Jeroen vormer,

Can you please send the OML File to sakthipriyabaktha@gmail.com. I am stuck on this flow. 

If you send means it would be very helpful for me.


UserImage.jpg
Dimas Widhi Prihatmadja


Hi Erul,
Can you send the OML you get to the email dimas.widi07@gmail.com? I also have the same problem, if you send the OML you got it will help me

Best Regard,

Dimas

2024-11-18 16-24-03
Vivek Patel

Hi Daniel , 

Above link is really help full for me .

Now i am passing content-type to multipart/form-data  .

But still i am not able to get response, getting error in response .

HTTP/1.1 500 InternalServerErrorContent-Type: application/json; charset=utf-8(Show all headers)

{  "messages": [    "Value cannot be null.\r\nParameter name: header"  ],  "developerMessage": null}


It seems that i am missing some more parameter related to header.


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Vivek,

In the meantime i removed my post, as I thought it would not apply for mobile apps,

Related to the article i posted there is another Forge component that you could have a look at:

https://www.outsystems.com/forge/component-overview/4026/multipart-form-data

Regards,

Daniel



2024-11-18 16-24-03
Vivek Patel

Hi Daniel,

Thanks for your suggestion ,But i dont wont to use forge component.

Can you please let me know how i can active in outsystems .



2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Just open the link and press the Install button.

From there follow the instructions.

For a complete guide on how to install a Forge component you can read the next document:

https://success.outsystems.com/Documentation/11/Getting_Started/Use_a_Forge_Component_Made_by_the_Community

Regards,

Daniel

UserImage.jpg
Omar Diaa

Can you send the OML file to omardiaa500@gmail.com

2024-11-18 16-24-03
Vivek Patel

Hii Daniel,

I dont wont to use forge component.

I want to consume Api in my own module .

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

It wasn't perfectly clear from how you wrote it in your previous post.

Anyhow you could just install it and see if it does what you need and learn from it. They ayou use that in your own code.

Regards,

Daniel

2024-11-18 16-24-03
Vivek Patel

Daniël Kuhlmann wrote:

Hi,

It wasn't perfectly clear from how you wrote it in your previous post.

Anyhow you could just install it and see if it does what you need and learn from it. They ayou use that in your own code.

Regards,

Daniel

Hi Daniel ,

I used the forge component suggested by you but when i go inside the component they have used extension .

Which i dont want to use.


UserImage.jpg
Omar Diaa

Can you send the OML file to omardiaa500@gmail.com?

2019-03-18 10-26-38
Jeroen Vormer

Vivek Patel wrote:

Hello Team ,


I am able to call api from postman as post method for uploading file into server.

But when i am consuming rest api in outsystems .I am not getting, how to set data in form-data .

I can only set send as body to input parameter.

I have attached an image of postman for reference.

Can anyone tell me how to test this api on outsystems platform.


 


Hi Vivek,


this should be very easy, but I cannot see te problem in your attached image.....
Is it possible to also send a image from the header tab from postman?
Also the end-point would be nice :-)

Best regards,
Jeroen 

2024-11-18 16-24-03
Vivek Patel

Jeroen Vormer wrote:

Vivek Patel wrote:

Hello Team ,


I am able to call api from postman as post method for uploading file into server.

But when i am consuming rest api in outsystems .I am not getting, how to set data in form-data .

I can only set send as body to input parameter.

I have attached an image of postman for reference.

Can anyone tell me how to test this api on outsystems platform.


 


Hi Vivek,


this should be very easy, but I cannot see te problem in your attached image.....
Is it possible to also send a image from the header tab from postman?
Also the end-point would be nice :-)

Best regards,
Jeroen 

Hi Jeroen,


Nothing to add in header part .

I have just used method POST ,URL of API and added values in body as key value pair shown in image.

Its working fine from postman, just need to know how to use from outsystems . 


2019-03-18 10-26-38
Jeroen Vormer

Vivek Patel wrote:

Jeroen Vormer wrote:

Vivek Patel wrote:

Hello Team ,


I am able to call api from postman as post method for uploading file into server.

But when i am consuming rest api in outsystems .I am not getting, how to set data in form-data .

I can only set send as body to input parameter.

I have attached an image of postman for reference.

Can anyone tell me how to test this api on outsystems platform.


 


Hi Vivek,


this should be very easy, but I cannot see te problem in your attached image.....
Is it possible to also send a image from the header tab from postman?
Also the end-point would be nice :-)

Best regards,
Jeroen 

Hi Jeroen,


Nothing to add in header part .

I have just used method POST ,URL of API and added values in body as key value pair shown in image.

Its working fine from postman, just need to know how to use from outsystems . 


Hi Vivek,


in that case:
which API are you trying to consume? A 3rd party or some from within you company?
If it is the first, could you specify the endpoint? 


UserImage.jpg
Dimas Widhi Prihatmadja

Hi Jeroen, 

can you send the file OML to my email to dimas.widi07@gmail.com? I have the same problem as this. If you send means it would be very helpful for me. 

2019-03-18 10-26-38
Jeroen Vormer

Hi Vivek,

if you don't want your thingy to be public, you can also email me at jeroen@vormerict.nl

2019-03-18 10-26-38
Jeroen Vormer
Solution

Hi Vivek,

you have to pass all your form data as binary because you have to also upload a file content.
Every form-data should start with a boundary which should also be specified in your header:
Your header "Content-Type" should be for example: 

SyntaxEditor Code Snippet

"multipart/form-data; boundary=Vivek"

Then each form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""" + <formData field name (key)> + """" + 
NewLine() +
<field value>


In case of a file the form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + <filename> + """", "") + 
NewLine() +
<file content (binary)>

All formdata text can be changed to binary using TextToBinaryData (from the BinaryData extension).

The all data should be concatenated using BinaryConcat (from BinaryConcat extension).
You can use the result of this concat in your request input parameter BinaryData in body).
In this request you have to use also the header mentioned above (multipart/form-data; boundary=Vivek).

This boundery also should be on the bottom of the total request (as binary) like:
--Vivek-- (including the dashes)


Obviously the response is depending on the API you're using....

I've sent an OML by email you can use for the particular API you are using.

Best Regards,
Jeroen



2020-02-10 17-36-40
Eruel Castillo

Jeroen Vormer wrote:

Hi Vivek,

you have to pass all your form data as binary because you have to also upload a file content.
Every form-data should start with a boundary which should also be specified in your header:
Your header "Content-Type" should be for example: 

SyntaxEditor Code Snippet

"multipart/form-data; boundary=Vivek"

Then each form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""" + <formData field name (key)> + """" + 
NewLine() +
<field value>


In case of a file the form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + <filename> + """", "") + 
NewLine() +
<file content (binary)>

All formdata text can be changed to binary using TextToBinaryData (from the BinaryData extension).

The all data should be concatenated using BinaryConcat (from BinaryConcat extension).
You can use the result of this concat in your request input parameter BinaryData in body).
In this request you have to use also the header mentioned above (multipart/form-data; boundary=Vivek).

This boundery also should be on the bottom of the total request (as binary) like:
--Vivek-- (including the dashes)


Obviously the response is depending on the API you're using....

I've sent an OML by email you can use for the particular API you are using.

Best Regards,
Jeroen



Hi Jeroen,

Can you also send me the OML for this? I have the same problem. Thank you!

Email : castilloeruel@gmail.com

Regards,

Eruel


2019-03-18 10-26-38
Jeroen Vormer

Eruel Castillo wrote:

Jeroen Vormer wrote:

Hi Vivek,

you have to pass all your form data as binary because you have to also upload a file content.
Every form-data should start with a boundary which should also be specified in your header:
Your header "Content-Type" should be for example: 

SyntaxEditor Code Snippet

"multipart/form-data; boundary=Vivek"

Then each form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""" + <formData field name (key)> + """" + 
NewLine() +
<field value>


In case of a file the form data should be something like this:

SyntaxEditor Code Snippet

NewLine() + 
"--Vivek" + 
NewLine() +
"Content-Disposition: form-data; name=""file""; filename=""" + <filename> + """", "") + 
NewLine() +
<file content (binary)>

All formdata text can be changed to binary using TextToBinaryData (from the BinaryData extension).

The all data should be concatenated using BinaryConcat (from BinaryConcat extension).
You can use the result of this concat in your request input parameter BinaryData in body).
In this request you have to use also the header mentioned above (multipart/form-data; boundary=Vivek).

This boundery also should be on the bottom of the total request (as binary) like:
--Vivek-- (including the dashes)


Obviously the response is depending on the API you're using....

I've sent an OML by email you can use for the particular API you are using.

Best Regards,
Jeroen



Hi Jeroen,

Can you also send me the OML for this? I have the same problem. Thank you!

Email : castilloeruel@gmail.com

Regards,

Eruel



Hi Eruel,


i've just sent you the oml by email.


Best regards,

Jeroen

UserImage.jpg
Shishir Shetty

Thanks for posting your answer. Can you send me the OML at this address: shettys@mskcc.org? 

UserImage.jpg
Omar Diaa

Can you send the OML file to omardiaa500@gmail.com?

UserImage.jpg
Daniel Breia


Hello Jeroen, could please send the oml file to this email daniel.breia@redshift.pt or just post a comment with the file? Thank you for your help.

UserImage.jpg
Rafael Ceballos

Hi I would like if possible to receive the OML  by email please to rceballos@axosbank.com please, I am stuck on this too

UserImage.jpg
Sakthipriya B

Hi Jeroen vormer,

Can you please send the OML File to sakthipriyabaktha@gmail.com. I am stuck on this flow. 

If you send means it would be very helpful for me.


UserImage.jpg
Dimas Widhi Prihatmadja


Hi Erul,
Can you send the OML you get to the email dimas.widi07@gmail.com? I also have the same problem, if you send the OML you got it will help me

Best Regard,

Dimas

2017-08-09 12-12-29
Jason Herrington

hello - can you please send this oml to jasonherrington@gatech.edu?

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