How to Pass file as a Datatype of the File as a File in Rest API ?

Hi, I am facing one issue of Uploading file Through Rest API.  I need to Pass the File as a Datatype Of File  In Rest API. Please check the PostMan screen Link. I need Exact way the File Type will be as a file datatype.   https://ibb.co/x688SQC

Please let me know if anybody has any idea on it. 

Hi Sudip,

There is no "file" data type. The data type (or rather, encoding) is "form-data" (commonly knows as multipart/form-data), "file" is just the name ("key"). There's no out-of-the-box solution for multipart/form-data, but you can check this article for some options.

Note that it depends on the specific service in what way you need to send the body in such a situation. You should check the documentation for your API what is expected.

Kilian Hekhuis wrote:

Hi Sudip,

There is no "file" data type. The data type (or rather, encoding) is "form-data" (commonly knows as multipart/form-data), "file" is just the name ("key"). There's no out-of-the-box solution for multipart/form-data, but you can check this article for some options.

Note that it depends on the specific service in what way you need to send the body in such a situation. You should check the documentation for your API what is expected.

My API is Expected to a File Type data. As I send the link for the PostMan. It is working fine in PostMan as Data Type is File.  By multipart data, the Uploading Filetype is Binary. Please let me know if there is a possibility to convert it into File type. 

Waiting for the Response.

Thank you,

Sudip


Sudip Dey wrote:

Kilian Hekhuis wrote:

Hi Sudip,

There is no "file" data type. The data type (or rather, encoding) is "form-data" (commonly knows as multipart/form-data), "file" is just the name ("key"). There's no out-of-the-box solution for multipart/form-data, but you can check this article for some options.

Note that it depends on the specific service in what way you need to send the body in such a situation. You should check the documentation for your API what is expected.

My API is Expected to a File Type data. As I send the link for the PostMan. It is working fine in PostMan as Data Type is File.  By multipart data, the Uploading Filetype is Binary. Please let me know if there is a possibility to convert it into File type. 

Waiting for the Response.

Thank you,

Sudip


This is what I need. Please check the attached screen.  I need to upload the data as a File type or convert the type binary to FileType. Waiting for your Response.


Thank you,

Sudip


Hi Sudip,

I already gave you the answer. There is no such thing as a "File" data type. But since you do not want to take my advise, I'll refrain from commenting any further. Good luck.

Sudip,

Can  you show where you've defined the File input on the target action or service (AE_FILE_DATA\NewAction)?

Sudip

From the error message in your screenshot, it is clear you cannot pass Binary Data (i.e. Upload1.Content).

The 'File' type is typically a structure created when consuming a REST API. You need to view this structure under the Data tab and set the values accordingly.

Like Killian said previously, there is no 'File' data type.

Hope this helps to solve your problem. Do let us know?

Hanno wrote:

Sudip

From the error message in your screenshot, it is clear you cannot pass Binary Data (i.e. Upload1.Content).

The 'File' type is typically a structure created when consuming a REST API. You need to view this structure under the Data tab and set the values accordingly.

Like Killian said previously, there is no 'File' data type.

Hope this helps to solve your problem. Do let us know?

The file is uploading as a binary. How I can able to set it as a File Type Structure. I have set all the Variable to File Type structure already but not able to set the uploaded file as a file type Structure. Will you let me know how I should able to set the Uploaded file content as a file type structure. 

Waiting for your Response. 

Thank you,

Sudip


Kevin Swanson wrote:

Sudip,

Can  you show where you've defined the File input on the target action or service (AE_FILE_DATA\NewAction)?

Yes it is in AE_File_Data\NewAction


Sudip can you please share the structure for the REST API Request?

If it is a really big file, you would need to do as Killian suggested.

I know that sometimes you need to convert a binary file to Base64 Text using the BinaryData extension to pass to a REST API. Perhaps POSTMAN is doing this in the background.

Can you try this?

Sudip, did you find a solution?

Hanno wrote:

Sudip, did you find a solution?

Hi Hano,

I did not got solution to upload the file as a File Type and pass it to the Rest API. Is it possible ? Did you check it?

Please let me know if you have any idea on it.

Thank you,

Sudip