Sending special characters to POST request not working as expected

4 weeks ago 23
ARTICLE AD BOX

I am getting a filter value as:

`~!@#$%^&*()_-+={}[]|\\:\";'<>,.?/

The team is providing special character as values, and testing whether the correct table data loads.

When I send to backend in post request body:

{ "filters": [ { "propertyName": "safetyKpiDateRange", "type": "dateRangeFilter", "range": { "left": "2026-02-07", "right": "2026-02-13" } }, { "propertyName": "eventType", "type": "stringEquals", "values": [ "Red", "Follow Distance", "Avoidance Zone" ] }, { "propertyName": "assetId", "type": "stringEquals", "values": [ "`~!@#$%^&*()_-+={}[]|\\:\";'<>,.?/" ] } ], "responseAttribute": [ "eventDetails", "secondaryAssets" ] }

I am getting response as:

{ "code": "400.012", "description": "Invalid request body", "solution": "Please provide valid request body or do not send" }

I understood it may happen because of raw special characters, so I converted the values (escape added) as follows:

"values": ["`~!@#$%^&*()_-+={}[]|\\\\:\";'<>,.?/"]

But still the error is not fixed. How can I handle this scenario?

Read Entire Article