Knowledge API Query issues
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 02:09 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 11:50 PM - edited 03-24-2025 11:51 PM
Hello @magnushedlu
Try using sysparm_query:
https://instance.service-now.com/api/sn_km_api/knowledge/articles?sysparm_query=textCONTAINScitrix
OR
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!