cancel
Showing results for 
Search instead for 
Did you mean: 

Sending files over webservice - binary data in HTTP request

Anonymous
Not applicable
Hi, Has any of you sent files from Blue Prism to an external endpoint using HTTP request (post)? I was wondering how to attach binary data to HTTP request using Utilty - HTTP object. Any ideas? Thanks Arek
8 REPLIES 8

Denis__Dennehy
Level 15
To send binary data over a rest webservice I would expect the data would need to be sent as some kind of text, potential within a JSON field using BASE64 text or something? Blue Prism provide the HTTP and JSON objects, i think the answer to this specific question about how best to structure your binary data within your JSON would probably require you to do some research on the internet.

Fabian_ObinnaNw
Level 2
Hello, Any object in Blue Prism that can decode Base64 encoded text? Thanks

OlaNykvist
Level 3
Not that I know of, but it's simple enough to create your own object with a code stage and something like this (untested, but should give you a starting point at least): var bytes = System.Convert.FromBase64String(encoded); var decoded = System.Text.Encoding.UTF8.GetString(bytes);

MichalKlodner
Level 3
It is an old post but I ran into the same issue. The solution is as follows: 1) Create a calculation stage with and look up File function called LoadBinaryFile 2) Provide Filepath and Store Result In (data item has to be Binary) 3) Pass the binary data item to your webservice I will be glad if you let me know if it helped (press Like) 🙂

I tried this but the result was unsuccessful. I am trying to POST a file using Multi Part Form Data. But when I send the data as binary, I receive no response. Can you please let me know if this was successful to you?

------------------------------
Skanda Thalya Shankarananda
------------------------------
Anonymous

If multipart/form-data doesn't work for you, you must be constructing a request in a wrong way. Maybe your boundary string appears in a file.
Show us the code.

p.s. Server in general should not care how you encode data in most cases, but urlencoding big binary file might have a noticeable overhead.

------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------

I am trying to attach a file to JIRA. Documentation regarding that can be found here -> https://docs.atlassian.com/DAC/rest/jira/6.1.html#d2e3258

I have attached few screen shots. It would great if anyone can help me out with this. I read somewhere that in body we just cannot give file path but we have to encode it.

23788.png
23789.png
23790.png


------------------------------
Anonymous
------------------------------
Anonymous

Body can be either multipart/form-data or application/x-www-form-urlencoded
For application/x-www-form-urlencoded, you urlencode a file (and other values)
For multipart/form-data you send binary file, but you have to set unique boundary and add other fields to request body.
https://dev.to/sidthesloth92/understanding-html-form-encoding-url-encoded-and-multipart-forms-3lpa




------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------