Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Encoded Query not working when it contains non-URL Safe characters

pault1
Kilo Contributor

Trying to query SN table via REST API and discovered that when I pass in a sysparm_query that contains non-URL Safe special characters, matching records are not returned.

Query Example:

"u_tag_source=Hosting^u_key=!@#$%^&*() A tag"

When I try to do the same thing in the table's List view, I get the same result.

First image is with a single filter on u_tag_source:

Capture1.JPG

Second image is by right-clicking the u_key column on the first record and selecting "Show Matching".

Capture2.JPG

Notice that the filter added cuts off everything after the percentage sign. And when I add that filter, the URL is set to:
nav_to.do?uri=/u_configuration_item_tag_list.do%3Fsysparm_query%3Du_tag_source%253DHosting%255Eu_key%253D!%2540%2523%2524%2525%255E%2526*()%2520A%2520tag%26sysparm_first_row%3D1%26sysparm_view%3D

I think the filter is not being URL encoded, which explains why this doesn't work in the UI, but

When I URLEncode the filter value and submit via REST API, this is what I am submitting:

"u_tag_source=Hosting^u_key=!%40%23%24%25%5e%26*()+A+tag"

This still doesn't work. Anyone seen this behavior and found a solution?

16 REPLIES 16

mmm. you mean through the TABLE API? Because within a REST API web service you could perform a Glide Record query.



Thanks,


Berny


Yes, correct, through table API