Calling restApi from UIPath by passing jsonObject as parameter



I need to pass a jsonObject with some values to a restapi as below“POST”, “http.----.”);
please specify the proper format to call so and get result.
by using http request it is giving internal server error.


@nikitashaw, Refer the Zipped file in the post How to Create JSON body text in HTTP Request

Dominic :slight_smile:


Thanks for the response. But in my case, I want to pass as a parameter (Not as Body)
We are trying below from JavaScript and it is working.

var passparam = ‘{“testdata”:"’ + document.getElementById(“testdata”).value + ‘"}’;
var passparamObj = JSON.stringify(passparam);
alert (passparamObj);
console.log(passparam);“POST”, “http://localhost:5002/XXXXXXXX”);
xhttp.setRequestHeader(“Content-Type”, “application/json;charset=UTF-8”);

But, when we try from UI path (HttpRequest activity), we get error below

500, Internal Server Error



@nikitashaw, Where (in which step ?) and what error you get in http request activity ?

Dominic :slight_smile: