/api/now/cxs/search API not working on knowledge base
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 06:27 AM
Hello,
I am trying to get the /api/now/cxs/search api to work, I have set up a service account that only has the role snc_internal, and am trying to run a query against a knowledge base that has no read user criteria against it (as I understand this means public basically).
When I run the search I get 0 results, however if i run it with my user credentials it works fine. Does anyone know any roles I need or any configuration I need to do to get this to work for my service account user?
Kind Regards
Ashley

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 06:45 AM
Odd. I just ran
curl "https://YOURINSTANCE.service-now.com/api/now/cxs/search?q=mail" \
--request GET \
--header "Accept:application/json" \
--user 'YOURACCOUNT':'YOURPASSWORD'
from a shell prompt and didn't have to give the account any roles to make it work. Curl makes a good test. Can you get that far to eliminate any additional variables from the other source trying to make the REST request?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 01:22 AM
Hi Chuck,
I am using RestMessageV2 currently to make the call, this is being called from the Server Side of a SP widget.
For some reason I am having to give my service account 'Knowledge Admin' before results are returned, I believe it to be an issue with access.
I have checked a few times, the knowledge base itself has no user criteria on the 'Can Read' side, and I have checked the ACL's to make sure nothing is going on there.
The call looks something like the below.
request.setEndpoint('https://INSTANCEHERE.service-now.com/api/now/cxs/search?start=0&cx=' + options.search_context + '&q='+strSearchTerm);
request.setHttpMethod('GET');
var user = 'USER';
var password = 'PASSWORD';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 04:54 AM
I would start by moving this to a script include and try it from a UI action and test it with your service account to ensure it works outside of Service Portal. You can unit test it with different personas, etc. this way. Once you are certain it works with the accounts/access it needs, you can then introduce SP in to the equation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2019 04:13 AM
Hi Chuck,
Not quite sure why, still trying to figure it out but it took giving my user knowledge_admin before results were returned. I will keep looking if there are any customisation's in the customers environment.
Great video by the way, thumbs up from me.