Trying to create REST API call to Add Item to Cart, but always get 400 Bad Request. Does anyone know what I'm doing wrong?

Luke10
Kilo Expert

Hi Everyone,

I'm working on a project where I need to make a REST API call to add an item to the cart and then check out the item. I'm using the REST API Explorer to build the call, but keep getting 400 Bad Request. 

I thought the sys_id needed is the sys_id of the catalog item but is it something else?

I'm still relatively new to ServiceNow so the answer may be obvious and I'm just missing it.

Thanks!

1 ACCEPTED SOLUTION

Did you set all the variables needed to add that item to cart? In the request body, under the raw tab, you can build it.

 

Take a look at these, it'll show you how.

https://community.servicenow.com/community?id=community_question&sys_id=1b282cc3dbaa97005129a851ca96...

 

https://community.servicenow.com/community?id=community_question&sys_id=e29eb665db58dbc01dcaf3231f96...

View solution in original post

4 REPLIES 4

Nitesh Balusu
Giga Guru

Can you check the response body? It should show why its failing.

It says....
 
{
  "error": {
    "message": "Invalid Quantity value",
    "detail": ""
  },
  "status": "failure"
}

 

Did you set all the variables needed to add that item to cart? In the request body, under the raw tab, you can build it.

 

Take a look at these, it'll show you how.

https://community.servicenow.com/community?id=community_question&sys_id=1b282cc3dbaa97005129a851ca96...

 

https://community.servicenow.com/community?id=community_question&sys_id=e29eb665db58dbc01dcaf3231f96...

Thanks, Nitesh. I didn't realize I needed to add my variables in the raw.