cancel
Showing results for 
Search instead for 
Did you mean: 

Making API requests using multipart-form data

bbastien
Level 4

Hello everyone ! 

I'm trying to use an API which does OCR, which means I'm supposed to send it an image file, and receive back a text which should include the text found inside the image.

I have tried to do so using only BluePrism's native web API services, but found that the multiple files option doesn't let me modify the request's body, and after looking into the forum's answers I found that it'd be better to use the http request multipart action.

Here's my problem though : When I try to send a request, I don't receive an error code but instead am told that an exception was thrown by the code stage : "one or more errors occurred", which makes it really hard for me to see what I'm doing wrong.


Below are screenshots of my overall collections, as well as that of the postman request which I am trying to base myself off in BluePrism:

bbastien_0-1736413417913.png

bbastien_1-1736413634196.png

bbastien_5-1736414898927.png

 

bbastien_2-1736414063832.png

 

bbastien_3-1736414190170.png

 

 

If someone know what I'm doing wrong  or even how I could fix my problem, I'd be very thankful !


Thank you in advance,

Bastien

 

2 REPLIES 2

steven.boggs
Staff
Staff

Hi Bastien,

As a first step, I'd recommend review of our Knowledge Base article, "How can I work with a multipart/form-data web request?". It contains several useful tips for getting this type of request to work within Blue Prism.

Thank you for the additional documentation ! However, some parts remain a bit hard for me to grasp :

The documentation you forwarded did allow me to make a (I hope) functional template and use the action corresponding to the request, as I finally got a response from the API server, which states that the image cannot be loaded.

As far as I can tell, it is what was mentionned in the link you forwarded, and was mentionned in multiple other posts on this forum, which is to say that binary data gets automatically converted to base64 and is therefore unreadable by the API.

So I deduce that I need to use the HTTP Request Multipart action, but then again, I cannot figure what in the way I filled my collections is wrong in such a way that it does not even forward my request and returns a code error...

Thank you in advance for your response,

Bastien