I have a scenario to pass json object for get request. Am able to pass json object in “post” type request. But am not able to send json in “get” type request. I tried to pass json string in “Body” properties, but still it always sends empty body. Could you please help to send json http get request.
Thanks for the reply. I understand, we can pass “parameters” as a collection for . But in my scenario, my API doesn’t accept parameter it accepts “Body” only.
For more understanding, i created my own web api. These are my following api.
[HttpGet]
public ActionResult<string> Get([FromBody] Input value)
{
return value.Value;
}
// POST api/values
[HttpPost]
public ActionResult<string> Post([FromBody] Input value)
{
return value.Value;
}
I tried to call the API from Postman with the body “{“value”:“test”}”. Its working fine for both “POST” & “GET” request.
I tried the same from UiPath, but in UiPath “POST” request working as expected, but “GET” request throws error as “input was not valid”. I used the same input for all requests even in postman too.
A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests. A server SHOULD read and forward a message-body on any request; if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request.