Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Request Item variables via REST API

bernard6
Mega Expert

I have a Catalog Item that has variables.   When I perform a Get for a request Item for that Catalog Item (sc_req_item) via the REST API it doesn't return the values that were set for the variables on that Request Item.   Is there a way to have these included in the Get or a way to query that information from the REST API?

1 ACCEPTED SOLUTION

joshua_bice
Giga Expert

You need to use the variable ownership table (sc_item_option_mtom). Query by the Request Item and you'll get a list of variables for it.


View solution in original post

16 REPLIES 16

bernard6
Mega Expert

Thanks Joshua!   That was exactly what I was looking for.


Not a problem. Glad I could help.


I am trying to get images of the item using the rest api /api/sn_sc/servicecatalog/items?sysparm_text=laptop


the image field is missing in the response.



when I try the rest api api/sn_sc/servicecatalog/items/8b6abec14f86c68085b73485f110c7fa   it does not give the field.



even I tried on api/now/table/sc_cat_item/8b6abec14f86c68085b73485f110c7fa


the field is present here but comes blank..



but when I try on the UI I see an image...


what api will help fetch me the image?


Images are stored as attachments in the sys_attachment table. You can use the attachment API to get them:


Attachment API


Hi David,


Would you please post an example of API you've used? I also have the same task, but can't get the list of variables.



Thanks,


Pavlo