Knowledge API Query issues

magnushedlu
Tera Guru

Hi all,

 

I have issues with the Knowledge API that do not render any results when using query.

 

For example: 

When I use "https://instance.service-now.com/api/sn_km_api/knowledge/articles"  I get all the articles listed.

When I use "https://instance.service-now.com/api/sn_km_api/knowledge/articles?query"  I also get all the articles listed.

BUT when I use "https://instance.service-now.com/api/sn_km_api/knowledge/articles?query=citrix" I get no hits back even though this should render results.

 

I tested both from external sources and from within the API Explorer, the results are the same. What am I missing? Do I need to do anything specific to make this work? I tested on both my live instance and on a PDI, same thing. Please help.

1 REPLY 1

Vishal Jaswal
Giga Sage

Hello @magnushedlu 


Try using sysparm_query:

 

https://instance.service-now.com/api/sn_km_api/knowledge/articles?sysparm_query=textCONTAINScitrix

 

OR

 

https://instance.service-now.com/api/sn_km_api/knowledge/articles?sysparm_query=short_descriptionCON...


sysparm_query tells ServiceNow to interpret the following string as a database query. `textCONTAINScitrix` searches the “text” field (which contains the article body) for the word “citrix”.

 

Reference: https://www.servicenow.com/community/developer-forum/field-contains-filter-in-api-link/m-p/1383518 

 


Hope that helps!