cancel
Showing results for 
Search instead for 
Did you mean: 

Web API Services - To upload a file using multipart form data

AbhilashM
Level 3
Hi Dear Community,

I have tried using form data module in postman to successfully upload the file to the target application. However, in the blue prism Web API services section - I am not able to successfully configure the API for upload.

The API documentation consumes the parameters as query params and use form-data to accept the file with multipart/form data and boundary established. Can you please guide me on how to go about setting this up in Blue Prism?

Thank you
Abhilash M
RPA Developer
Lowe's Companies.

------------------------------
Abhilash M
------------------------------
19 REPLIES 19

Hi Dear Community,

The API is now successfully uploading the file to the target application. Thank you Shashank Kumar and all members in the thread for helping me out on the issue.

Details for your reference:
  • VBO:- Utility - HTTP 6.10.3
  • Action - HTTP Request Multipart
  • Parameters populated in said Action are as below
  • Address URL:- The complete URL for the API with query params
  • Headers:- A collection containing required headers for the request
  • FileMetadata:- File based form-data body parameters(key value pairs) as implemented in postman (Donot use file binary input here as suggessted earlier)
  • FieldMetadata:-File meta data 

File meta data contains:-
  • FileName : Left blank since optional
  • FieldName : file
  • ContentType : application/octet-stream
  • FilePath : Absolute file path

Thank you
Abhilash M
Lowe's Companies

------------------------------
Abhilash M
------------------------------

Hi @AbhilashM

I am implementing a similar case in Blue prism using your solution reference. But, I am getting 500 status code.
My File meta data contains :
  • FileName : Left blank since optional
  • FieldName : file
  • ContentType : application/octet-stream
  • FilePath : Absolute file path
Could you please let me know what I need to set in the FieldMetadata collection ? Your solution screenshot will be helpful for me .
Also, I do not need to set Content-Type as "multipart/form-data" explicity. Is my understanding right?

Many Thanks!
​​

------------------------------
Kiran Singh
------------------------------

Hi @shashank.kumar280 ,

I am facing similar issue while sending xlsx file with the HTTP Request Multipart action in the ​HTTP-Utility VBO.

The file metadata has:

FieldName : file
ContentType: multipart/form-data
FilePath: Absolute path of the xlsx file

What should be given in the FieldMetadata? It is having Name and Value as fields? Should I covert the xlsx file into binary file?​

------------------------------
sushma Achar
------------------------------

I struggled with this for a while too, so hopefully this will help.

In my case, I am posting a csv file. I set the filename and absolute filepath in the filesCollection. I do not set the content type or field name. I do not use the fieldmetadata collection at all. I don't think there is any need to set the content type in the filesCollection, though to post excel it may need to be application/vnd.ms-excel.

Regards
Neil.

------------------------------
Neil Jordan
------------------------------

Hello @neiljor,

Could you please share the screenshots of your implementation ?
That might be useful, as I am still stuck with the problem.

Thanks in Advance!

Kind Regards,
Kiran Singh​​

------------------------------
Kiran Singh
------------------------------

The FileMetadata contains metadata for the binary file to be uploaded.
The FileName, FieldName and ContentType in FileMetadata are optional. If left blank the FileName is derived from the FilePath, Fieldname is set to "file" and Content-Type is derived from the file present at the provided FilePath.
Eg. If it was a excel file the Content-Type would be automatically set as application/vnd.ms-excel.

The FieldMetadata should contain all the key/value pairs other than the binary file. If there are none, then leave this blank.

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

Thank You @neiljor @shashank.kumar280,

API is working now. ​​​

------------------------------
Kiran Singh
------------------------------

Hi @neiljor @shashank.kumar280
I am facing similar issue. Attaching screenshots for your reference.
If you could please reply back with correction and screenshots for better understanding.

Postman
27540.png

Blueprism
27541.png

27542.png



------------------------------
Jishnu P Nair
------------------------------

Hi @Jishnu P Nair, I would suggest checking the force pre authorization setting, and your headers. For my use case I had to logon to the service using one API which returned a token that I had to use in an Authorization header for the upload call.



------------------------------
Neil Jordan
------------------------------

JoãoCorreia
Level 2

HI Community,

Could you guys help me?
I'm trying to upload a txt file to through the api, but im getting error 401 while doing it.
I already tried to upload others files extensions but i cant Understand why the .txt isnt working.
27546.png27547.pngAnd another thing is that when i tried using Postman, the file go without issues.



------------------------------
João Correia
------------------------------