I try to send a PUT request to a specific company website’s api. Basically it’s a ticket system (Remedy / BMC). In this request I want to add a worklog entry (which works perfectly). But if I want to attach a file to this worklog entry I have to be very specific about my request.
I made it work in postman, but now I’m having serious trouble translating this to the UIPath’s HttpClient.
So first things first, here is the working example in my postman:
So these parameters you can see here have to be exactly like this. Even the “Key” has to be like this, otherwise it won’t work.
Now how can I create the same thing in the UIPath’s httpClient? I need to send some JSON data + the file itself with a octet-stream in a multiform/form-data request.
I tried all combinations I could think about in UIPath. I played with the headers, with the body, with the attachment properties but it won’t work.
Also in Postman I have the ability to choose a file from my computer. How can I do the same thing in UIPath? I have to use a path right? But where and how to use it exactly?
TL;DR How can I make the exact same request from the screenshot in UIPath’s httpClient?
But how does the request know where the test.txt is physically located on the file system? On the header I have the same, except for the key. Here I have Content-Type instead of enctype.
If you have file in UiPath project folder you don’t need use full path to file otherwise you have to
It’s only hint because it’s hard find straight solution without access to similar environment.
The setup which I gave you works fine for sending images for captcha.
Ok, thank you very much. The thing with this environment is it’s very strict. I have to send the request exactly as shown in my postman screenshot. Otherwise, it won’t work since it’s a very old, strict, and outdated API (which I can’t change in any shape or form).
Sorry, I don’t understand that part:
Can you elaborate in more detail to me?
Ok I know what you mean. I will try that and get back to you (tomorrow). Thx
Also: Where should I include my JSON Data? I have to add the json data + the data file in my request as shown in my postman. How to combine these two so it’s exactly like in postman? should I also include it into the attachment (since it’s another kind of form entry), or should I include it in the request body?
I mean the test.txt file if it is in the same folder where you have UiPath project you don’t need to value input full path of the file.
I’m afraid if you want send json data you have to add JSON content to body as string. And here you have to aware because it is string and everything where you have double quotes you have to add additional two. Like in this example:
{
“something”: “qweqwe”,
“description”: “Test”,
“User”: “pikorpa”
}
you should transform to:
{
““something””: ““qweqwe””,
““description””: ““Test””,
““User””: ““pikorpa””
}
Hi can you please elaborate in more detail? Thank you very much.
I think I kind of have to write my own http client in a invoke code but it’s very hard for me as of right now.