Unable to add body to the Post API of the Http request

Hello Everyone,

Here I’m trying to send a post request to the Http activity with the below body content

Original Body Content:

{
“searchFilterMap”: {
“issueDate”: {
“fieldName”: “issueDate”,
“filterOperator”: “gt”,
“filterValue”: “2018-10-04”,
“andOrOperator”: “AND”
}
},
“paging”: {
“page”: 1,
“pageSize”: 100
},
“sortList”: [
{
“property”: “issueDate”,
“direction”: “DESC”
}
],
“resultList”: [ ]
}

So when I try to use this in body property of HTTP it is throwing an error ",} is accepted. the same body when I tried with the postman, it’s working. I formatted the body with double quotes as well. but still no luck. can someone help me on this formatting plz?

Formatted Body to pass that to the Http activity:

“{
““searchFilterMap””:”{
“issueDate”“:”"{
““fieldName””: ““issueDate””,
““filterOperator””: ““gt””,
““filterValue””: "“2018-10-04"”,
““andOrOperator””: ““AND””

}"
},
“paging”: "{
““page””: "“1"”,
““pageSize””: 100

}",
“sortList”: “[”
"{
““Property””: ““issueDate””,
““direction””: ““DESC””

}"
“]”,
“resultList”“: “”[ ]”"
}"

Thank you.
Praveen Kumar Gogula

Hi @praveengogula

Welcome to our UiPath Forum :slight_smile:

I believe for the purpose of putting the payload in the HTTP Request activity Body field, you will need to put everything as a long string without line breaks.

1 Like

thanks for responding,

I have given it as string without line breaks as below, still same error:

"{""searchFilterMap"":""{""issueDate"":""{""fieldName"":""issueDate"",""filterOperator"":""gt"",""filterValue"":""2018-10-04"",""andOrOperator"":""AND""}""}"",""paging"":""{""page"":"1",""pageSize"":"100"}"",""sortList"":"["{""property"":""issueDate"",""direction"":""DESC""}"],""resultList"":"[]"}"

Try this one

"{""searchFilterMap"": {""issueDate"": {""fieldName"": ""issueDate"",""filterOperator"": ""gt"",""filterValue"": ""2018-10-04"",""andOrOperator"": ""AND""}},""paging"": {""page"": 1,""pageSize"": 100},""sortList"": [{""property"": ""issueDate"",""direction"": ""DESC""}],""resultList"": [ ]}"

You only need to escape the quote with another quote. How I typically do it, is to feed the original string to Notepad++ and work on it there. For your source string, I first removed all returns by running a simple regex replace, and then did a replace all from

"

to

""
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.