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

bernyalvarado
Mega Sage

Hi Paul,



Try using STARTSWITH instead of =



Thanks,


Berny


Also, here goes a list of escaping types that are used in Jelly. I'm sharing this since \ is a generic escaping way for strings.



http://wiki.servicenow.com/index.php?title=How_to_Escape_in_Jelly#gsc.tab=0



Thanks,


Berny


bernyalvarado
Mega Sage

Is regards the special character where it's getting cut off, you may want to try to escape the character. That's different from a URL encoding since the string on this case it's not a URL based string



Thanks,


Berny


bernyalvarado
Mega Sage

By the way... i just tried escaping with:



\^



and it worked for me



Thanks,


Berny