How to send Http Request with Content-Type: image/jpeg?

Hi all,

I have built a simple server to expose an OCR model as an API.
The API is very simple, expecting a POST request with Content-Type: image/jpeg, and then return an array of strings with a single prediction, e.g. [‘0123’].

Using Postman I can successfully POST and get the response but simple setting to headers { key: Content-Type, value: image/jpeg }, and sending an image in the body as form-data with { key: “image”, value: “” }.

I can also successfully POST and get the response using cURL:
curl -F ‘image=@’

When trying to translate this to HTTP Request activity, I keep getting status 400 Bad Request.
I have tried the following parameters:
Method: POST
Attachments: { Name: image, Value: “” }
Headers: { Name: Content-Type, Value: “image/jpeg” }
Body: “multipart/form-data”

I have verified using that the request body is being received as application/octet-stream, and this is probably why the API is complaining.

I have searched every thread about HTTP Requests in UiPath forum, and none provides a clear solution for POSTing images.

I’ve also tried using UiPath to send a cURL, but still haven’t got that to work either.

Thanks in advance.

when I sent in http request the image (eg. to resolve captcha) I used header:

and in attachments:

And it worked.

This worked, I don’t believe it.
Thanks man!

I am happy that I could help :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.