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
‎02-16-2022 10:57 AM
Hi Mallikarjuna,
I was able to escape the string characters using below format using Rest message API.
var endpoint = "http://example.com/api";
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('get');
request.setEndpoint(endpoint);
request1.setQueryParameter('$filter',"type eq 'classic' or type eq 'modern'");
Using above formatting in query parameter method, I was able to achieve the below query
var apiEndpointwithQuery = "http://example.com/api$fitler = type eq 'classic' or type eq 'modern'"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 11:53 AM
Hello Jagadeesh,
I have something similar but the filter isn't applying.
below is endpoint I'm trying to query
"http://example.com/api/v1/Items?$filter=criteria/itemID eq 'abc'";
var request = new sn_ws.RESTMessageV2();
request.setHttpMethod('get');
request.setEndpoint(endpoint);
request.setQueryParameter('$filter',"criteria/itemID eq 'abc''");
We are just getting all results and query is not added.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 06:27 AM
Hi @Bharath38 ,
I imagine that you solved this a long time ago, but I can see an extra quote after 'abc'. It shouldn't be 'abc''"); it should be 'abc'");
Also, whilst that / in the middle of the string shouldn't cause any issues, you might need to escape it like this criteria\/itemID.
Also, based on your comment about returning all of the records, I'm assuming that you set the endpoint variable, as it's not in your code snippet.
Thanks,
Jason (please mark as helpful if this extremely late answer helped, thank you).