servicenowservicenow-rest-api

" Mandatory fields missing" error while using ServiceNow API


I am using ServiceNow API to create a Catalog request.

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"
    }
}

I got this error :

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

How can I know what are the mandatory fields?


Solution

  • I figured out that this ID will be used to get the mandatory variables. https://<ServiceNow>/api/sn_sc/servicecatalog/items/<Item_ID>/variables

    However, I don't find it on the service now official documentation.

    It should be a scripted API.