Create a Service Catalog Request via REST API

Katie A
Mega Guru

Hello, is it possible to create a Service Catalog Request programmatically using the REST API?

We have an existing Requested Item and we want to request it via REST API script externally.

Thanks!

9 REPLIES 9

Sai Anna
ServiceNow Employee
ServiceNow Employee

Yes it is possible by using Service Catalog API, please refer Service Catalog API for more information. you can also refer


How to create service catalog request using REST API






Thanks,


Sai


Hit like, Helpful or Correct depending on the impact of the response


Thank you. How can we set the value of the variables in the script? This example shows how to add to cart, but does not show how to set any of the variables on the requested item.



Service Catalog API - POST /sn_sc/servicecatalog/items/{sys_id}/add_to_cart


According to the documentation sysparm_quantity is required along with variables in the request body.   Variables are in an object with variable names and their values.   So something like the following should work:


{"sysparm_quantity":"1","variables":{"user":"user_name"}}


Sai Anna
ServiceNow Employee
ServiceNow Employee

you have to place "variables" in JSON format:





sample body:



Screen Shot 2017-06-07 at 12.57.28 PM.png



here skill_numbers_list,reqFor are variable names.




Thanks,


Sai