如何在任何地方使用 Service Now Rest API 自动化关闭任务? 我需要使用 RestAPI 关闭工单,你能帮帮我吗?
使用 REST API Explorer,选择 修改记录 (PUT)、表名 incident 和工单的 sys_id。
身体需要3个领域:
{
"state":"7",
"close_code":"Closed/Resolved by Caller",
"close_notes":"blabla"
}
close_code(在 UI 中也称为 Resolution code)是强制性的。对于可接受的值,在 UI 中导航至 System Definition / Choice Lists,然后搜索表事件,元素 close_code。
close_notes(在 UI 中也称为 Resolution notes)是强制性的,但它是自由文本。
state 是 6 表示 Resolved,或者 7 表示 Closed。
在搜索论坛并尝试不同的解决方案后,我终于能够通过使用带有这些参数的补丁请求成功关闭问题单。 使用 UTAH 版本的 Table api 端点,
https://<instance>.service-now.com/api/now/v1/table/incident/{incident_id}'
resolve = \
{
"close_code": "Closed/Resolved By Caller",
"incident_state": "7",
"caller_id": "admin",
"close_notes": "Closed by API"
}