If API JSON payload contains '%' (Percentage) character then REST call is not working

Srini T
Kilo Contributor

If description or short_description fields contains '%' then API response getting as 200 but   no incident id in response as incident is not created in ServiceNow. Is this issue with sending side or ServiceNow side? If I remove the '%' from payload then it was working fine.

The sample payload i am using is

{

  "third_party_incident_number":"00000000012",

  "company":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx",

  "caller":"xxxxxxxxxxxxxxxxxxxxxxxxxxx",

  "service_offering":"xxxxxxxxxxxxxxxxxxxxxxxxxxx",

  "configuration_item":"xxxxxxxxx",

  "urgency":"Medium",

  "category":"Error",

  "assignment_group":"XXXxxxxxxx",

  "short_description":"Average (5 samples) total cpu is now 80.19%, which is above the warning threshold (80%)",

  "description":"Average (5 samples) total cpu is now 80.19%, which is above the warning threshold (80%)"

}

I verified whether above JSON payload is valid or not in JSONLint - The JSON Validator.and confirmed it was valid JSON

2 REPLIES 2

Artemis15
Kilo Guru

Hi Srini,



use encodeURI() to encode payload.



--


Cheers,


AR


srinivasthelu
Tera Guru

Hi Srini,



I suggest you to use encode your payload with encodeURIComponent(payload). This will ensure encoding special characters.



Thanks


Srini