Create request in servicenow through REST API integration using Cart API

Arindam Ghosh
Mega Guru

Gertting below error while creating request in servicenow through REST API integration using Cart API:

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

Not sure why. Third party is sending the Payload in below format with all mandatory fields on request form:

Creation message: {
  "variables": {
    "description": "my request description",
    "short_description": "my request",
    "requested_for": "777713784fd4d8888ddab33181108885",
  },
  "sysparm_quantity": "1"
}

Appreciate your help.

1 ACCEPTED SOLUTION

Thanks for the response. The issue was with the variable name. I misspelled one variable name which caused this issue.

View solution in original post

9 REPLIES 9

sachin_namjoshi
Kilo Patron
Kilo Patron

This means that they need to pass some mandatory variable value in payload.

You have to look at your REST API definition to see which fields are mandatory.

 

Regards,

Sachin

Can you help me understanding that? I didn't find any other variable.

 

Thanks,

Arindam

Greetings Arindam,

 Best option is to try this with the rest api explorer. Namespace - sn_sc. You typically need to get the variables for an item, to see which ones are required in order to submit the item to be requested. In this case, it appears your catalog item you are trying to request requires a detail variable, which you are not providing. 

-Andrew Barnes
Join me at Developer Blog

Thanks Andy. I tried the same way and still getting the below error:

Here is the endpoint:find_real_file.png Also here is the Error that I am getting:

{
  "error": {
    "detail": "",
    "message": "Cart is empty!"
  },
  "status": "failure"
}