Request service catalog item on behalf of someone through Service Catalog REST API

nevo
Kilo Contributor

I'm new to servicenow and I've tried to create a service catalog request from ServiceCatalog REST API. Everything worked fine except I would like to change "requested for" for the item request when adding the item to the cart and checkout. I've searched over the communities here and the only close one is this: service catalog - REST api to create request behalf of requester

I understand variables must be associated with the item so they are specific to the item. My question is whether there's actually an API way to set "requested for" info for the requested item through Service Catalog API (addcart, checkout, submit, etc). By that, I meant you don't have to create some variable to some item, just like when I started a fresh instance, enable two-step checkout, then I could submit order for someone.

Thanks!

1 ACCEPTED SOLUTION

larstange
Mega Sage

Hi



It doesn't look like it is possible using the Service Catalog REST API.



But it is possible using the CartJS api - https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_CJSS-getRequestedFor



var cart = new sn_sc.CartJS();


cart.setRequestedFor("039c516237b1300054b6a3549dbe5dfc")



So you could write your own scripted REST API and route the information through the CartJS api instead. See this for inspiration CartJS API to add multiple item to cart and submit order


View solution in original post

6 REPLIES 6

larstange
Mega Sage

Hi



It doesn't look like it is possible using the Service Catalog REST API.



But it is possible using the CartJS api - https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_CJSS-getRequestedFor



var cart = new sn_sc.CartJS();


cart.setRequestedFor("039c516237b1300054b6a3549dbe5dfc")



So you could write your own scripted REST API and route the information through the CartJS api instead. See this for inspiration CartJS API to add multiple item to cart and submit order


nevo
Kilo Contributor

Hi Lars,



Thanks for your suggests.



I could very much understand scripted REST API might be the best and perhaps the only API way. In this regard, since I've tried to integrate with third party SN and usually I won't have full access to its env, and I'm still new to SN, so my question is is it possible that I   package a scripted REST API web service (into a zip file, e.g) and upload it to SN through either UI or some other means   so that web service could be deployed automatically by SN, or is there a way to perform unattended installation/deployment of the scripted REST web service? Thanks again.


larstange
Mega Sage

Hi



To my knowledge it is not possible to do what you are asking here - only a user with the admin role can commit update sets.


But you could make a scoped application with this scripted REST API in it, and request that any of your third party partners install that for you to be able to integrate to them


nevo
Kilo Contributor

Hi,



This sounds helpful. I'll give a try.   Thanks for your suggest!