Service Catalog API - POST /sn_sc/servicecatalog/items/{sys_id}/add_to_cart

This method adds an item to the cart of the current user.

URL format

Versioned URL: /api/sn_sc/v1/servicecatalog/items/{sys_id}/add_to_cart

Default URL: /api/sn_sc/servicecatalog/items/{sys_id}/add_to_cart

Supported request parameters

Table 1. Parameters
Parameter Description


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
Table 3. Response headers
Header Description

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 completed successfully and the item is added to the cart. And the response contains all the details of the items currently in the cart.
400 The following errors can occur:
  • Invalid quantity value:Indicates that either the sysparm_quantity parameter is not provided or contains invalid value.
  • Security constraints prevent ordering of Item:Indicates that either the Cart Item ID specified in the path parameters is either invalid or the user does not have access to the item.
  • Mandatory Variables are required:Indicates that one or more of the mandatory variable values is not provided in the request.

Request and response body

The following are parameters for the request body.

Table 5. Values required in the request body
Parameter Description
sysparm_quantity Specifies the quantity of the item to be added to the cart. It is mandatory to provide this parameter and make sure that it is a non-negative number.
variables Object consisting of all variable names and their corresponding valid values. Provide values for all the mandatory variables, as shown in the following example.
The following are JSON or XML values included in the response.
Table 6. Values returned in the response body
Parameter Description
cart_id Specifies the sys_id of the cart.
subtotal Specifies the subtotal of the items.
items Array consisting of details of all the items in the cart.
catalog_item_id Specifies the sys_id of the item in the cart.
quantity Specifies the quantity of the item in the cart.
localized_price Specifies the price of the item in local currency of the user.
price Specifies the price of the item.
localized_recurring_price Specifies the recurring price of the item in local currency of the user.
recurring_price Specifies the recurring price of the item.
item_name Specifies the name of the item in the cart.
cart_item_id Specifies the sys_id of the item in the cart.

Sample cURL request and response

curl "" \
--request POST \
--header "Accept:application/json" \
--user 'admin':'admin'
            "item_name":"Apple iPhone 5",

Sample Python request and response

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

# Set the request parameters
url = ''

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

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

# Do the HTTP request
response =, 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())

# Decode the JSON response into a dictionary and use the data
data = response.json()
<?xml version="1.0" encoding="UTF-8"?>
            <item_name>Apple iPhone 5</item_name>