REST API Request for Catalog Item

snowblind
Tera Expert

Hi,

How do I submit a request for a catalog item via REST?  Here's why I tried:

$> curl -v -u 'snowid:snowpass' --header "Content-Type: application/json" --request POST --data-binary @Internal-SSL-Certificate-Request.json https://company.service-now.com/api/sn_sc/servicecatalog/items/cdf6d374c3d0fd90cc253bee05013113/submit_producer

That yields:

{"error":{"message":"Record Producer does not exists","detail":""},"status":"failure"}

 

1 ACCEPTED SOLUTION

That endpoint works fine with a GET, both with the GUI and curl.  That's how I know my credentials are okay.

 

The issue turns out to be that I should be using a different endpoint than the docs and GUI suggest.  For the record, this is how to order a catalog item with curl:

 

curl -v -u 'id:pass' --header "Content-Type: application/json" --request POST --data-binary @Internal-SSL-Certificate-Request.json 

 

View solution in original post

8 REPLIES 8

Those are the steps I followed.  I provided the catalog item sys_id, not the record producer sys_id.

Amit Verma
Kilo Patron
Kilo Patron

Hi @snowblind

 

Can you try calling this API from the ServiceNow REST API explorer itself instead of Curl ? Also, in the REST API explorer, please try to get your catalog item first using the Specific Catalog Item API which is available on endpoint 

https://yourinstance.service-now.com/api/sn_sc/servicecatalog/items/{sys_id}

This is just to ensure that your are targeting the right catalog item.

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

That endpoint works fine with a GET, both with the GUI and curl.  That's how I know my credentials are okay.

 

The issue turns out to be that I should be using a different endpoint than the docs and GUI suggest.  For the record, this is how to order a catalog item with curl:

 

curl -v -u 'id:pass' --header "Content-Type: application/json" --request POST --data-binary @Internal-SSL-Certificate-Request.json 

 

Tai Vu
Kilo Patron
Kilo Patron

Hi @snowblind 

There's a couple of things you can double-check.

1. Verify this sys_id "cdf6d374c3d0fd90cc253bee05013113" exist in the Record Producer [sc_cat_item_producer] table.

2. Validate the Authenticated user has access to the Record Producer.

URL: https://<instance_name>/sc_cat_item_producer.do?sys_id=cdf6d374c3d0fd90cc253bee05013113

3. Use REST API Explorer in ServiceNow and verify if you're able to submit it there.
Timi_1-1703755851626.png

 

Cheers,

Tai Vu