logo

NJP

Submit catalog request using Service catalog API

Import · Apr 30, 2022 · article

We can utilize the Service catalog API to raise catalog requests from external applications when integrating third-party applications with ServiceNow.

We'll need two important APIs to submit the request image

> Add Item To Cart (POST)

> Submit Order (POST)

STEPS TO REPRODUCE

1.) Open REST API EXPLORER from Application navigator

image

2.) Choose Namespace as sn_sc and Select Add Item To Cart (POST)

image

3.) Upon selecting the Add Item To Cart (POST)

> To identify the Item Give the Catalog Item sys_id in path parameters > Provide Request body in the Raw format

> For Example, I have selected the OOTB Standard laptop as Catalog Item

image

> Now give the request body, which should include the following information:

sysparm_also_request_for - Optional sysparm_quantity - Required. Quantity of the item. Cannot be a negative number. Data type: Number Variables - Name-value pairs of all mandatory cart item variables. Mandatory variables are defined in the associated form.

Data type: String

Sample RAW format

{ 
'sysparm_quantity': 1,
'variables': { 

'acrobat' : 'true',
'photoshop' : 'true',
'Additional_software_requirements' : 'Testing Service catalog API' 

}
}

image

4.) Upon submission you should get the below response

image

5.) Now that the items have been added to the cart, we must submit the request using the Submit Order (POST) API.

image

6.) We can submit without giving any more information in the Request body after selecting the API. The ideal response should be as follows:

image

7.) You can check the Request by navigating to the Request form/RITM form, as shown below.

image

References :

> https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_ServiceCatalogAPI#r_SCatAPIA...

> https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_ServiceCatalogAPI#servicecat...

Please give your valuable feedback and post comments if any corrections are required image

Regards,
Sai Kumar Bolisetty

Community Rising Star 2022

Labels:

image

View original source

https://www.servicenow.com/community/itsm-articles/submit-catalog-request-using-service-catalog-api/ta-p/2305836