yesterday
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:
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
yesterday
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.
yesterday
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
11 hours ago
Hi @bbastien
I have used the HTTP - Multipart action for one of my process recently, please find the details on how i have used it, it may help you.
In my case we have couple certs provided by the endpoint API and that was installed into the bot machine key store, so we refere the the cert based on certificate ID. you can ignore if it is not applicable.
File Meta data collection,
File name and file path has to be provided as per the file is being posted.
As per you screenshots, you have mentioned Filemetadata.Content type = Multipart/form-data, can you try to change that to application/json and fieldname as well and let me know?
Thanks,
Nandha
10 hours ago
Looking at your Postman screenshot you can try setting the FieldMetadata collection to blank and try setting the FileMetadata collection's Content-Type as image/jpeg or application/octet-stream
9 hours ago
Yes the content type i have used was application/json because i was sending the json in a .txt file.
In you case it has to be image/jpeg or application/octet-stream as mentioned by Shashank
thanks,
Nandha
4 hours ago
Hello @Nandhakumar , thank you for your response ! I tried to change the FileMetadata.Content Type to application/json, but still got a code error from the HTTP request action
However I'm not sure what I should change the fieldname to ?
As far as I could tell, the only fields possible for the image to be uploaded were image and url, depending on the method the API needs to use to access the image, but I may be missing something important here.
Is there something that I am doing wrong with my file metadata collection ?
Thank you in advance for your response !
Bastien
4 hours ago
Hello and thank you for your response !
I have tried leaving the FieldMetadata field blank and using either "image/jpeg" or "application/octet-stream", but the action still returns me a code error...
4 hours ago
Thank you for the clarification, I was using the image/jpeg value by default, and tried the application/json just to be sure, but it didn't seem to fix the issue, and since the only error I get is "Internal : Could not execute code stage because exception thrown by code stage: One or more errors occurred.", I really cannot figure out what is causing it, do you maybe have an idea of what that could be ?
Thank you in advance for your response,
Bastien