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

 

1 REPLY 1

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);