- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2021 11:51 PM
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!
Regards,
Raskill
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2021 02:04 AM
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"
}
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2021 12:37 AM
You can take the reference of AISASearchUtil script include
/sys_script_include.do?sys_id=95b8c180773310104470303697106186
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2021 02:04 AM
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"
}
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2021 05:31 AM
Thanks Oleg, This helped massively!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2021 09:42 AM
Hi Raskill,
As far as I know, there aren't any customer callable REST APIs for AI Search.
Sorry for the confusion with the AI Search Assist REST API as it is for internal ServiceNow use which is why it is not publicly documented.
To clear that up, we'll make sure to rename it in future releases so it will be more like the CAB Workbench (Internal API).
Regards
Matt