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

This method retrieves a list of categories for a catalog.

URL format

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

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

Supported request parameters

Table 1. Parameters
Parameter Description
sysparam_top_level_only Gets only those categories whose parent is a catalog.
sysparam_limit Number of categories in the result.
sysparam_view Specify the device to display the item (desktop, mobile, or both).
sysparam_offset Offset to set the query window.

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 categories in a catalog. If the query results in no categories then an empty array is returned.
400 Indicates that the request is invalid and catalog sys_id is invalid.
500 Internal error.

Sample cURL request and response

curl "https://instance.service-now.com/api/sn_sc/v1/servicecatalog/catalogs/e0d08b13c3330100c8b837659bba8fb4/categories?sysparm_limit=10&sysparm_offset=12;rel="first" \
--request GET \
--header "Accept:application/json" \
--user 'admin':'admin'
{
  "result": [
    {"title": "Desktops",
      "description": "Desktop computers for your work area.",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "1bface31475211002ee987e8dee49095.iix",
      "sys_id": "900682363731300054b6a3549dbe5d5f"
    },
    {"title": "Furniture and Decor",
      "description": "Order new furniture, and fixtures, or request for\n\t\t\tfurniture to be repaired. Cubicle modifications can also be ordered\n\t\t\there\n\t\t",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "",
      "sys_id": "d2f716fcc611227a015a142fa0b262c1"
    },
    {"title": "Hardware",
      "description": "Order from a variety of hardware to meet your business\n\t\t\tneeds, including phones, tablets and laptops.",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "c4b933e9471211002ee987e8dee49064.iix",
      "sys_id": "d258b953c611227a0146101fb1be7c31"
    },
    {"title": "Janitorial",
      "description": "Request for cleaning services to be performed\n\t\t",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "",
      "sys_id": "d2f83003c611227a01a81bd5bd54b1aa"
    },
    {"title": "Laptops",
      "description": "Laptop computers for mobile workers.",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "ec5b0271475211002ee987e8dee49042.iix",
      "sys_id": "59f586f23731300054b6a3549dbe5db7"
    },
    {"title": "Maintenance and Repair",
      "description": "Request for a shared office equipment to be repaired\n\t\t",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "",
      "sys_id": "d2f86388c611227a002209db6966d5ad"
    },
    {"title": "Mobiles",
      "description": "Cell phones to meet your business needs.",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "ff6b0271475211002ee987e8dee490d2.iix",
      "sys_id": "d68eb4d637b1300054b6a3549dbe5db2"
    },
    {"title": "Network Standard Changes",
      "description": "Standard change templates relating to network related changes: Adding new switches, upgrading IOS etc",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "",
      "sys_id": "abbcbbbf47700200e90d87e8dee49041"
    },
    {"title": "Office",
      "description": "Office services such as printing, supplies requisition\n\t\t\tand document shipping and delivery.",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "498b0271475211002ee987e8dee490ea.iix",
      "sys_id": "109cdff8c6112276003b17991a09ad65"
    },
    {"title": "Peripherals",
      "description": "End user peripherals such as mobile phone cases, dongles,\n\t\t\tand cables",
      "full_description": null,
      "icon": "",
      "header_icon": "",
      "homepage_image": "a39f470c4fc89200086eeed18110c7df.iix",
      "sys_id": "2c0b59874f7b4200086eeed18110c71f"
    }
  ]
}

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/catalogs/e0d08b13c3330100c8b837659bba8fb4/categories?sysparm_limit=10&sysparm_offset=12;rel="next"'
url = 'https://instance.service-now.com/api/sn_sc/v1/servicecatalog/catalogs/e0d08b13c3330100c8b837659bba8fb4/categories?sysparm_limit=10&sysparm_offset=20;rel="last"'

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

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

# 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)
None