Service Catalog API - GET /sn_sc/servicecatalog/categories/{sys_id}

This method retrieves all the information about a requested category.

URL format

Versioned URL: /api/sn_sc/v1/servicecatalog/categories/{sys_id}

Default URL: /api/sn_sc/servicecatalog/categories/{sys_id}

Supported request parameters

Table 1. Parameters
Parameter Description
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, see REST response codes .

Table 4. Status codes
Status code Description
200 Indicates that the request has completed successfully and returns all the details of the category.
400 Indicates that request is invalid for one of the following reasons:
  • User does not have access to the category.
  • Invalid sys_id.
500 Internal error occurred while executing the request.

Response body values

Following are JSON or XML response parameters for a request completed successfully. The response consists of details of the category.

Table 5. Response parameters
Parameter Description
title Title of the category.
sys_id SysId of the category.
icon The source of the small icon displayed beside the category name, when the category is listed as a subcategory.
header_icon The source of the icon displayed beside the category header, when the category is listed at the top-level category.
description Short description about the category.
full_description Full description about the category.
homepage_image The HomePageImage source of the category.
mobile_image The image source used for the category in mobiles.
child_categories The list of categories that belong to this category. Each object in the list gives the sys_id and title of the category that belong to this category.

Sample cURL request

curl "https://instance.service-now.com/api/sn_sc/servicecatalog/categories/b0fdfb01932002009ca87a75e57ffbe9" \
      --request GET \
      --header "Accept:application/json" \
      --user 'admin':'admin'
{
        "result": {
          "title": "Standard Changes",
          "description": "Standard Change Template Library",
          "full_description": null,
          "icon": "",
          "header_icon": "",
          "homepage_image": "",
          "sys_id": "b0fdfb01932002009ca87a75e57ffbe9",
          "child_categories": [
            {
              "sys_id": "abbcbbbf47700200e90d87e8dee49041",
              "title": "Network Standard Changes"
            },
            {
              "sys_id": "b3ecbbbf47700200e90d87e8dee49081",
              "title": "Server Standard Changes"
            },
            {
              "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/servicecatalog/categories/b0fdfb01932002009ca87a75e57ffbe9'

        # 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>b0fdfb01932002009ca87a75e57ffbe9</sys_id>
          <full_description>null</full_description>
          <header_icon />
          <homepage_image />
          <icon />
          <description>Standard Change Template Library</description>
          <child_categories>
             <sys_id>abbcbbbf47700200e90d87e8dee49041</sys_id>
             <title>Network Standard Changes</title>
          </child_categories>
          <child_categories>
             <sys_id>b3ecbbbf47700200e90d87e8dee49081</sys_id>
             <title>Server Standard Changes</title>
          </child_categories>
          <child_categories>
             <sys_id>00728916937002002dcef157b67ffb6d</sys_id>
             <title>Template Management</title>
          </child_categories>
          <title>Standard Changes</title>
       </result>
      </response>