In order to attach a file(image in my case) with the HTTP request, I’ve used my file location in the “Attachments” Options.
I’ve added BodyFormat “application/binary” and as Headers I have my authorization token + Content-Type as “application/binary”.
Unfortunately the file that is attached is of an unknown type - not recognized as an image.
Any ideas how to solve this? Or how to add a binary file in UiPath on a HTTP request?
We have attachments option where we have to attach the files for the request. Just try to pass the same headers and body even the URL parameters (Query params) same as post man and check what is the status you are getting
Yes, I’m using the Attachment option, where I’ve added the path of the local file that I want to pass by.
Headers, URL parameters are exactly the same, the body is empty. But is not working
same problem exist for me also…do anyone in this forum knows what is wrong ?
do we have to mention the file to be attached in body property of uipath and body format as application/Any?
On the image above, you can see I’ve attached 2 files to the ticket.
The one on the bottom is what I’ve uploaded via POSTMAN, and the one on top is using UiPath http request. So my guess is that something on the UiPath’s request is not correct/working.
Below are the exact params that I’m using in UiPath in case you see something missing or incorrect
Have you found a solution? I’ve got a similar problem. In my case with Postman works fine. Trying to replicate the same configuration in an HTTP request of Uipath I can post the file, but I can’t open it once posted.(my file is a .msg of Outlook).
I found that inside the file has been added on top and at the bottom some rows. Any idea?
For the name untitled I suggest you to insert a row in the header with the key Document-Name and as value the name of the file.
Dim client As RestClient = New RestClient("https://{{replace}}.zendesk.com/api/v2/uploads.json?filename=vaibrasil.png")
client.Timeout = 10000
Dim request As RestRequest= New RestRequest(Method.POST)
request.AddHeader("Authorization", "Basic {{replace}}")
request.AddHeader("Content-Type", "image/png")
request.AddParameter("image/png", File.ReadAllBytes("C:\Users\gustavo.cervelin\Downloads\vaibrasil.png"), ParameterType.RequestBody)
Dim response As IRestResponse = client.Execute(request)
Console.WriteLine(response.Content)
IMPORTANT NOTES:
Replace {{replace}} at first line with you subdomain;
Change filename parameter value at first line;
Set timeout as you want at second line;
At line four, replace {{replace}} with your email+token combination (base 64);
At line five, set the content type according your file extension;
The same for line six
That’s it guys!
If you need help to work with the response, let me know
Na época que eu estava trabalhando nesta integração com o Zendesk (Abril de 2020), eu tentei muito fazer funcionar utilizando HTTP Request activity. Mas não consegui
Então, me veio a ideia de fazer por linha de código com a Invoke Code activity e deu certo
Se é o único jeito? Não consigo te afirmar 100% pois parei de explorar outras possibilidades depois que a segunda opção (Invoke Code) deu certa.