Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

REST API Explorer: I have to give the POST method url for submiting the catalog item request form

NikhilKumaK
Tera Expert

Hi Team,

 

I have a requirement to give the POST HTTP link for submitting the catalog item request form,
I have tried using:
Namespace: sn_sc
API Name: Service Catalog API

Buy Item (POST)
sys_id: (Given sys_id of catalog item)
In Raw Data:
{
"sysparm_quantity": "1",
"requested_by": "sys_id of user",
"requested_for": "sys_id of user",
"discription": "API test",
"assignment_group": "sys_id of group"
}
}

After including the mandate variables value as it throwing an error messge: 

Mandatory Variables are required


POST HTTP: 

POST https://dev.service-now.com/api/sn_sc/servicecatalog/items/catalog_item_sys_id/order_now

Status code

400 Bad Request

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


It would be helpful, if any suggestion provided to send the correct variable format.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@NikhilKumaK 

share the variables associated to that catalog item?

are you sure mandatory variables are set via JSON?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Yes, I have mentioned all the mandatory variables in Raw Data and the variable values are also correctly mentioned even though it's  says: 

Mandatory Variables are required

@NikhilKumaK 

you didn't share screenshots of those variables.

are those mandatory at variable config level or some client script or UI policy is making those mandatory?

The OOTB API should only check mandatory variables at config level.

Check if some customization is added to that.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader