Cant create a catalog item using REST API

Karthik66
Mega Contributor

find_real_file.png

1 ACCEPTED SOLUTION

Hi Ankur,

No, its still the same. I had to use Order now API 1st to add to cart and then submit order API next to create the REQ. As i dont have much time to troubleshoot further i have done it this way for now and moving ahead.

Still, many thanks for your help.

Regards,

Karthik

View solution in original post

14 REPLIES 14

Hi Karthik,

What error you get i.e. error message and the http status code?

Regards
Ankur

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

Hi Ankur,

its successful, 200 status code but only successful in creating cart.

Status code : 200

{
  "result": {
    "cart_id": "ffa6144adb28dc100bcc1c0e0496191e"
  }
}
 
In my personal instance,
 
same API call returns below.
 
Status code : 200
 
{
  "result": {
    "sys_id": "d7a650c61ba4901065f3ed3abc4bcb2f",
    "number": "REQ0010095",
    "request_number": "REQ0010095",
    "request_id": "d7a650c61ba4901065f3ed3abc4bcb2f",
    "table": "sc_request"
  }
}

Hi Karthik,

can you try this method; it worked for me even when 2 step property was true/false

glide.sc.checkout.twostep.back

Buy Item (POST) -> give sys_id of the catalog item in the URL

https://instanceName.service-now.com/api/sn_sc/servicecatalog/items/a96250e407d01410540bf2508c1ed014/order_now

Request Body: highlighted in bold is sys_id of catalog item

{
        'sysparm_id': 'a96250e407d01410540bf2508c1ed014',
        'sysparm_quantity': '1',
        'variables':{
        'test': 'hello',
        'group': 'd625dccec0a8016700a222a0f7900d06'
        }

}

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur, thats exactly is my API cal already.

 

 

Still the response is only cart ID 😞

 

Hi Karthik,

can you give request body in the format as the example I shared?

Regards
Ankur

 

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