Http Get Request Parameters in the Body

Hi There,

I was wondering if the HTTP Request activity accepts parameters in the Body for a GET request. Although its not common, i have a usecase where the parameters are sent via the body and not using the parameters property (for the queryString). This works with tools like Postman or even in a C# app, but doesnt work in UiPath Studio

Thank you
Hara

1 Like

That’s possible
Check this example

Video demo as well

Cheers @Hara_Gopal

@Hara_Gopal

it is possible

can you please tell what you tried?

cheers

We’re u able to do with the above references @Hara_Gopal

unfortunately it did not work. The examples given above may work for POST requests but not for GET requests, or may be I missed something. I finally wrote VB using Invoke code. Here is it if it helps:

Dim client As New System.Net.Http.HttpClient()
Dim request As New System.Net.Http.HttpRequestMessage(System.Net.Http.HttpMethod.Get, url)

Dim byteArray =  System.Text.Encoding.UTF8.GetBytes(apiUser + ":" + apiPassword)
request.Headers.Add("Authorization", "Basic " & Convert.ToBase64String(byteArray))

Dim bodyParameters As New Dictionary(Of String, String)()
bodyParameters.Add("key", val)

Dim bodyContent As New System.Net.Http.StringContent(JsonConvert.SerializeObject(bodyParameters), System.Text.Encoding.UTF8, "application/json")
request.Content = bodyContent

Dim response As System.Net.Http.HttpResponseMessage = client.SendAsync(request).Result
checklistStatus = Convert.ToBoolean(response.Content.ReadAsStringAsync().Result)

Cheers
Hara

1 Like