Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Create catalog request using this REST API through Service Catalog API

Mohan Mallapu
Kilo Sage

Hi All,

We have a requirement to create catalog request using this REST API with the help of Service catalog API -/api/sn_sc/servicecatalog/items/{sys_id}/order_now , Here i am using BUY ITEM(POST) call.

 

Catalog is getting created successfully with below payload 

{"sysparm_quantity":"1","variables":{"description":"TESTING REST API EXPLORER","requestor_information":"true","requested_for":"a3b4d485db499010bdcfd5ab5e961972"}}

But instead of 'sys_id' of 'requested_for', I want to pass user_name of the user. How we can achieve this.

Appreciate for the quick response. Thank You.

1 ACCEPTED SOLUTION

Thanks,. Service catalog API will only allow sys_id's for reference variables, 
I have created the custom scripted REST API to achieve this. 

View solution in original post

7 REPLIES 7

AnveshKumar M
Tera Sage
Tera Sage

Hi @Mohan Mallapu ,

You need to use custom Scripted REST API, the ServiceCatalog API will not handle user_names.

Thanks,
Anvesh

Slava Savitsky
Giga Sage

First, query the User [sys_user] table using the Table API to find the appropriate user record by user_name and grab their sys_id. Then plug that sys_id into the second REST call using Service Catalog API to place an order in the name of the given user.

Vishal Birajdar
Giga Sage

Hi @Mohan Mallapu ,

 

As mentioned by @Saurav11 , user_name (User Id) will work.

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates