hello I have a problem I need to send some parameters to an http request, but the parameters must be of the form-data type, I have not managed to find out how to send the same, I know that in the activity comes the option to send a string, but I do not achieve know what is the format of it
If you are referring to the Content-Type parameter, you can specify it in the Headers property of the HTTP request activity:
Name: Content-Type, Direction: In, Type: String, Value: "multipart/form-data"
If you want to send a file with the request, you can pass the filepath to the Attachments property.
This helped, thanks lot
If i have some key-value text fields instead of files then how to set them inside http request?
Have you tried using the Parameters property? It gives you the key-value format that you mentioned.
Also, how are you doing the request in another tool? If you are specifying a JSON string in the body of the request, then it might be simpler to just do the same and pass that string to the Body property.
There is some solution to this? I’m having same problem.
Trying to send one ‘application/pdf’ and one ‘text/plain’ into the body so this is and obvious multipart/form-data problem
I don’t know how to fill uipath HTTP Request activity properties to find a good HTTP Status 200
I’ve thought maybe putting in headers the content-type = multipart/form-data and then using parameters to send both, file and text buth the text parameter called “example” cannot be recognized. the request throws me an HTTP Status 400 - Required request part ‘example’ is not present
i want to pass form-data in http request how where i have to give this information in that activity ?
did you got any solution for this ?
Hi, I got this long back, but discussion went on another thread too so I posted solution there.
In this video, I use multipart/form-data:
0:20 cURL example
1:35 Send the command from POSTMAN
2:50 Implement the code in C#
4:20 Run the code
4:50 Visual Basic code VB.NET
6:20 New Process on UiPath Studio with Invoke Code
7:20 Imports Libraries in UiPath Studio
8:30 Run the Robot to Upload and Download the file
Dim client As HttpClient = New HttpClient()
client.BaseAddress = New Uri(“YOUR URL”)
// for BASIC AUTH
Dim byteArray As Byte() = Encoding.ASCII.GetBytes(“username:password”)
client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue(“Basic”, Convert.ToBase64String(byteArray))Dim byteArray As Byte() = Encoding.ASCII.GetBytes(“username:password”)
// for OAUTH2
client.DefaultRequestHeaders.Add(“authorization”, “Bearer YOUR TOKEN”)
Dim request As MultipartFormDataContent = New MultipartFormDataContent()
request.Add(New StringContent(“tags”), “Bad”)
request.Add(New StringContent(“displayreferencetext”), “true”)
request.Add(New StringContent(“similaritythreshold”), “0.63”)
request.Add(New StreamContent(File.OpenRead(“C:\8A.docx”)), “file”, (New FileInfo(“C:\8A.docx”).Name))
Dim response As HttpResponseMessage = client.PostAsync("", request).Result
Dim strm As Stream = response.Content.ReadAsStreamAsync.Result
Dim doc As Byte()
Dim ms As MemoryStream = New MemoryStream()
doc = ms.ToArray()
I found the video a little hard to follow and seemed to be more about downloading files than uploading. It also wasn’t clear what I need to change in the code too work with my use case
This is the procedure. You need software developer skills. Please watch again the first 3 minutes of the movie and then try all your steps in your case from Postman. After everything is working in Postman then jump to Visual Studio and build code, Last step will be UiPath.
I’m not really a software developer, I’m trying to understand this procedure! would be preferable if the UiPath activity would do this!
do I need to specify here what file type I am uploading
And how do I know what syntax to use?