Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Calling ServiceNow AI search through REST API

peter_repan
Kilo Sage

Hi guys, has anyone experience with calling ServiceNow AI search through REST API ? We are struggling to understand how to provide correct parameters into out of the box function "search" in Script Include AISASearchUtilSNC. We are struggling how to provide facetFilters and searchFilters in correct format. There is no documentation available anywhere.

peter_repan_0-1747212368100.png

 

2 REPLIES 2

Brian104
Tera Expert
 
const RPSYID = /// now/nav/ui/classic/params/target/aisa_rp_config_list.do (find your "Search Results" sys_id

const SEARCHCONTEXT = // now/nav/ui/classic/params/target/sys_search_context_config_list.do (pick one).  I built my own to only return certain types of data

const
body = {
    searchTerm: query,
    searchContextConfigId: SEARCHCONTEXT,
    rpSysId: RPSYSID,
    disableAllSuggestions: false,     // keep suggestions / ranking logic
    disableSpellCheck: false         // allow typo correction
  };

  const resp = await this.http.post(`/api/now/aisa/search`, body);

Peter de Bock1
Mega Guru

We found another AI search API which works pretty well for us. It might be an option for too to have a look at it. See this article I just posted;  https://www.servicenow.com/community/servicenow-otto-for-creator/using-ai-search-from-server-side-sc...

 

regards, Peter