Service Catalog API - GET /sn_sc/servicecatalog/items

This method retrieves a list of catalogs and a list of items for each catalog.

URL format

Versioned URL: /api/sn_sc/v1/servicecatalog/items

Default URL: /api/sn_sc/servicecatalog/items

Supported request parameters

Table 1. Parameters
Parameter Description
sysparm_category Specify the category sys_id of the item.
sysparm_type Specify the type of item. For example, Record Producer, Order Guide. This field is used by the item-search to search specified item types.
sysparm_limit Specify the number of entities in the response. This value applies to categories and items.
sysparm_text Specify query text for search support. (Required)
sysparm_offset Specify the offset used for pagination.
sysparm_catalog Specify the catalog sys_id of the item.
sysparm_view Defines the device that displays the Item:
  • Desktop (desktop)
  • Mobile (mobile)
  • Desktop and Mobile (both)

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 2. Request headers
Header Description
None
Table 3. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, seeREST response codes.

Table 4. Status codes
Status code Description
200 Returns a list of catalogs and items available. If a valid query results in no items, then the response body contains only an empty result array.
500 Internal error.

Sample cURL request

curl "https://instance.service-now.com/api/sn_sc/servicecatalog/items?sysparm_limit=2" \
--request GET \
--header "Accept:application/json" \
--user 'admin':'admin'
{
  "result": [
    {
      "sys_id": "0034e2559f90120066dabde8132e7054",
      "short_description": null,
      "catalogs": [
        {
          "sys_id": "0b22fd2ad7021100b9a5c7400e610319",
          "title": "Admin Home"
        }
      ],
      "name": "ITSM Guided Setup",
      "icon": "images/nav_bult.gif",
      "description": "",
      "show_price": false,
      "type": "catalog_item",
      "category": {
        "sys_id": "fc000d749f10120066dabde8132e7091",
        "title": "Guided Setup"
      }
    },
    {
      "sys_id": "011f117a9f3002002920bde8132e7020",
      "short_description": null,
      "catalogs": [
        {
          "sys_id": "e0d08b13c3330100c8b837659bba8fb4",
          "title": "Service Catalog"
        }
      ],
      "name": "Retire a Standard Change Template",
      "icon": "images/icons/catalog_item.gifx",
      "description": "<p class=\"p1\"><font size=\"2\"><span class=\"s1\">Request an existing Standard Change Template is made unavailable when it is no longer required or no longer acceptable as a Standard Change.  This will be confirmed by your Change Management team.</span></font></p>",
      "show_price": false,
      "type": "record_producer",
      "category": {
        "sys_id": "00728916937002002dcef157b67ffb6d",
        "title": "Template Management"
      }
    }
  ]
}

Sample Python request

#Need to install requests package for python
#easy_install requests
import requests

# Set the request parameters
url = 'https://instance.service-now.com/api/sn_sc/v1/servicecatalog/items?sysparm_limit=10'

# Eg. User name="admin", Password="admin" for this code sample.
user = 'admin'
pwd = 'admin'

# Set proper headers
headers = {"Content-Type":"application/json","Accept":"application/xml"}

# Do the HTTP request
response = requests.get(url, auth=(user, pwd), headers=headers )

# Check for HTTP codes other than 200
if response.status_code != 200:
    print('Status:', response.status_code, 'Headers:', response.headers, 'Error Response:',response.json())
    exit()

# Decode the JSON response into a dictionary and use the data
data = response.json()
print(data)
<?xml version="1.0" encoding="UTF-8”?>
<response>
  <result>
    <sys_id>011f117a9f3002002920bde8132e7020</sys_id>
    <short_description>null</short_description>
    <catalogs><sys_id>e0d08b13c3330100c8b837659bba8fb4</sys_id><title>Service Catalog</title></catalogs>
    <name>Retire a Standard Change Template</name>
    <icon>images/icons/catalog_item.gifx</icon>
    <description>&lt;p class=&quot;p1&quot;&gt;&lt;font size=&quot;2&quot;&gt;&lt;span class=&quot;s1&quot;&gt;
      Request an existing Standard Change Template is made unavailable when it is no longer required or no 
      longer acceptable as a Standard Change.  This will be confirmed by your Change Management team.&lt;
      /span&gt;&lt;/font&gt;&lt;/p&gt;</description>
    <show_price>false</show_price>
    <type>record_producer</type>
    <category><sys_id>00728916937002002dcef157b67ffb6d</sys_id><title>Template Management</title></category>
  </result>
</response>