How to escape double quotes(") in rest endpoint url for OutBound rest message? %22 is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2021 12:39 PM
Hi,
I use " in my rest end point url for a get query to Nlyte and I am unable to escape it using %22. Please refer the url below and let me know where I'm doing it wrong.
http://IP-Address/nlyte/integration/api/odata/AssetsAndHosts?$filter=((SerialNumber%20ne%20%22%22)&(SerialNumber%20ne%20null))&$select=AssetName,AssetNumber,
What I want to achieve is (SerialNukber ne "" & SerialNumber ne null)
Using %20 (SerialNumber%20ne%20null) for space encoding is working fine
http://IP-Address/nlyte/integration/api/odata/AssetsAndHosts?$filter=((SerialNumber%20ne%20%22%22)&(SerialNumber%20ne%20null))&$select=AssetName,AssetNumber,SerialNumber
Error message:
{
"error":{
"code":"","message":"The request is invalid.","innererror":{
"message":"An error has occurred, please verify parameter values and try again.For detailed information please contact system administrator or check server logs.\nInternal Error Message: Syntax error: character '\"' is not valid at position 18 in '((SerialNumber ne \"\")'.","type":"","stacktrace":""
}
}
}
Regards,
Akshatha
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2021 03:22 PM
Hi Akshatha,
Have you tried using backslash (\
) with double quotes(")? Something like this (\").
Regards,
Muhammad
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2021 01:01 AM
It did not work, it says invalid URI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2021 01:19 AM
Hi,
You can use variable substitution for that and then use setStringParameterNoEscape()
Variable substitution in outbound REST messages
setStringParameter() vs setStringParameterNoEscape()
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2021 11:15 AM
Can you explain this in detail? How exactly am I supposed to make use of this in the code?
(SerialNumber%20ne%20$input) --> Is this the url in the rest endpoint?
sm.setStringParameterNoEscape("input",""""); --> Is this the way to use it where we call this rest message?
A little more detailed explanation would be really helpful.