Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Are there any REST APIs for AI Search?

Raskill1
Giga Contributor

Hi Team,

Are there are REST APIs available for the AI Search feature?

currently I see an API in the 'now' namespace called - 'AI Search Assist REST Service'. But I cannot seem to find any API documentation on this like what parameters are accepted, what is expected in the request body and so on. Can anyone of the experts in this forum help with this regard? Deeply appreciate the support!

 

find_real_file.png

 

Regards,

Raskill 

1 ACCEPTED SOLUTION

Oleg
Mega Sage

AI Search Assist REST Service isn't documented, but its full source code of the Scripted REST API can be seen here: /nav_to.do?uri=%2Fsys_ws_operation.do%3Fsys_id%3D938801807733101044703036971061dd. The API is a REST API wrapper to search method of Script Include AISASearchUtil (see /nav_to.do?uri=%2Fsys_script_include.do%3Fsys_id%3D95b8c180773310104470303697106186).

The code of AISASearchUtil.search() tests the beginning existence of searchContextConfigId, searchTerm and rpSysId parameter of the input request. The meaning of is clear to guess: it's the searching term/text.

The value of searchContextConfigId parameter is sys_id of some record of Search Context Configuration [sys_search_context_config] table. By default exist two items: "Service Portal Default Search Application" with sys_id=00731b9d5b231010d9a5ce1a8581c7dd and "[AI Search Assist] - Incident Deflection" with sys_id=2056f9de67621010b3d782f45685efd0.

Finally, the value of rpSysId parameter is probably (based on the code of AISARecordProducerUtils.getRPConfigByRPId() method) sys_id of Record Producer field (sc_cat_item field) of some record from "Record Producer Configuration" [aisa_rp_config] table. By default, aisa_rp_config table contains only one item with the reference to the Record Producer "Create Incident" having sys_id=3f1dd0320a0a0b99000a53f7604a2ef9.

So the request to AI Search Assist REST Service could contains the following data for example:

{
	"rpSysId": "3f1dd0320a0a0b99000a53f7604a2ef9",
	"searchContextConfigId": "2056f9de67621010b3d782f45685efd0",
	"searchTerm": "test"
}

find_real_file.png

Final remark: To tell the trust I could not find why the rpSysId parameter is so important for the API. If one would use any non-empty value, the results seems be the same.

View solution in original post

5 REPLIES 5

Peter de Bock1
Mega Guru

The  "sn_search.ScriptableSearchAPI" API can be easily exposed by a REST scripted API webservice. 

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