Calling restApi from UIPath by passing jsonObject as parameter

I need to pass a jsonObject with some values to a restapi as below
xhttp.open(“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 - #6 by Susana

Regards,
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);
xhttp.open(“POST”, “http://localhost:5002/XXXXXXXX”);
xhttp.setRequestHeader(“Content-Type”, “application/json;charset=UTF-8”);
xhttp.send(passparamObj);
}

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

500, Internal Server Error

Thanks,

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

Regards,
Dominic :slight_smile: