Web API Image response integration

jgab12

New Member
Hi everyone,

I have this API that I'm calling that returns a png image as a response. I can't seem to figure out the right code to extract the data and to store it in a image data item. It looks like that Blue Prism assumes that it will receive the response as text.

Thank you very much!
 

Pete_L

Active Member
I have not done this personlly, as I've never had to work with an image being returned by an API call, but here's what I think might work (I'm writing this from memory so please forgive me if it is lacking in details):

In the Parameters setting of the Web API definition, you set up the data type, method (I've only ever used JSON Path), and JSON Path notation for the JSON-formatted values that are being returned by the API call. Each of these parameters that you set up will appear as outputs of the Web API Object when you use the method in your Process, and you will need to assign data types for them and provide Data Item names for them. Use the Image data type on the parameters configuration screen for the image file that is retured by the API. This should hopefully give you the image in a Data Item. Remember to give the Data Item the Image data type.

Check out the Web API user guide on the BP Portal for more complete details.
 

Mikkora

New Member
I had similar issues with PDF. To solve this, we used Utility - HTTP, HTTP Request file -action.

You need to configure the object to match your target API.

In my case, it was following:
1634888011087.png

And the headers was:
1634888111961.png
ContentType: application/json
Authorization: Basic. (username & PW converted to Base64)
 

ewilson

Member
The Blue Prism WebAPI feature has a known limitation related to the handling of response data. As you mentioned, everything is handled as text. This causes issues if you try returning anything that's in a binary format. The only solution, at the moment, is to make those requests using the Utility - HTTP VBO. There is a ticket that's been open with the product folks for some time around this. Hopefully we will see a fix/enhancement sometime in 2022.

Cheers,
Eric
 
Top