使用 ServiceNow 时出现“缺少必填字段”错误 API

" Mandatory fields missing" error while using ServiceNow API

我正在使用 ServiceNow API 创建目录请求。

URL:

https://<ServiceNow>/api/sn_sc/servicecatalog/items/6e2cc01d4f51ce08d4fb2b8ca310c7a6/order_now

BODY:

{
    "sysparm_quantity":"1",
    "variables":  {
        "requestor":"6e2cc01d4f51ce08d4fb2b8ca310c7a6",
        "Requested For":"6e2cc01d4f51ce08d4fb2b8ca310c7a6",
        "Group Name":"01304c6ddbef9f0827673672399619c4",
        "Group Domain":"FG",
        "Rationale for Approver Only (this will not be viewed by fulfillment team)":"testing"
    }
}

我遇到了这个错误:

{
    "error": {
        "detail": "",
        "message": "Mandatory Variables are required"
    },
    "status": "failure"
}

我怎么知道哪些是必填字段?

我发现这个 ID 将用于获取强制变量。 https://<ServiceNow>/api/sn_sc/servicecatalog/items/<Item_ID>/variables

但是,我在现在的服务官方文档中没有找到它。

应该是脚本化的API。

在打开表单的同时检查浏览器中的元素选项卡(F12 for Chrome)并搜索“variable_tab”,您将在其中看到所有预期的变量。你可以通过查看表格来弄清楚强制性的是如何调用的。