Security constraints prevent ordering of Item

suzie
Kilo Explorer

Trying to use the REST API to create service catalog items and receiving this response:

Security constraints prevent ordering of Item

Here is the Request:

POST https://<instance-name>/api/sn_sc/servicecatalog/items/3Dbbc694f8db8033403242f9baae9619dc/add_to_cart

Body of Request:

{
"sysparm_quantity": 1,

"variables": 
{
"Short_Description": "Test",
"System": "Workday",
"Requestedby": "3Dfd9a1b54dbd32f001c1079fdae9619c0",
"Subcategory": "Finance",
"Description:": "Test"

}
}

Response:

400 Bad Request

{
  "error": {
    "message": "Security constraints prevent ordering of Item",
    "detail": ""
  },
  "status": "failure"
}

I have tried several different things, including creating my own REST API in ServiceNow and calling that.
Nothing works.
Has anyone ever successfully used these APIs?
 
7 REPLIES 7

smcdonaldaz
Tera Guru

I know this is a older post and you most likely found the answer but for the benefit of others I wanted to add that when I got this I used "User Criteria Diagnostics" to find the integration user did not have access to the catalog item.  To test your condition "admin" is not specifically granted access access to my HR New Hire request and failed the user criteria.  User Criteria diagnostics is a very helpful tool and will tell you at what point access is getting denied.

Hi, I am getting this error from my program running on a Java server. But the same payload with the credential works fine from POSTMAN running on my personal workstation. I would appreciate any pointer to what my problem might be. Thank you!

Wei-Jyh Lin

Bill Ye Zhang
Tera Contributor

Hi suzie,

 

I ran into the same issue today and played around. I somehow managed to fix it. 

 

What I did was I realized the Catalog Item I was trying the API on didn't have a Flow or workflow attached to it. So I tried another one that had a published Flow attached. The response worked. Then it worked on the original Catalog Item even if it still doesn't have any Flow or workflow attached.  I don't know what happened. It was as if my sys admin credentials got cached so it worked.

 

Hope this helps. Or maybe you got it fixed long time ago.