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

This method retrieves an array of contents requested for checkout.

URL format

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

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

Supported request parameters

Table 1. Parameters
Parameter Description
None

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. 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 3. Status codes
Status code Description
200 Indicates that the request has completed successfully.
  • Is not two-step: Items are added to cart and cart contents are returned.
  • Is two-step: Returns the request number and request sys_id after checkout.
400 Indicates that the request is invalid. Could be due to one of the following reasons:
  • One or more items sent do not exist.
  • User does not have access to one or more of the items.
  • Mandatory variables of one or more items have not been answered. (Only variables defined as mandatory are honored.)
  • Quantity value is sent and is not a positive integer.
500 Service error. Internal error during checkout.

Request body

The API requires these JSON or XML elements in the request body to specify a checkout guide.

Table 4. Elements required in the request body
Element Description
Items Array of items requested for checkout. Each item is a JSON object with the following parameters:
  • sys_id: ID of the item, which is a required parameter.
  • variables: JSON object of variable name value pairs.
  • sysparam_quantity: Quantity of item. If not specified, the default value is 1.

Response body

If two-step verification is false, the API returns these JSON or XML elements in the response body to describe the order status.

Table 5. Elements returned in the response body when two-step checkout is false
Element Description
cart_id Specifies the sys_id of the cart.
subtotal_price Specifies the subtotal of the cart.
subtotal_recurring_frequency Specifies the recurring frequency subtotal of the cart.
subtotal_recurring_price Specifies the recurring price subtotal of the cart.
total_title Specifies the title for total field on page.
subtotal_price Specifies the subtotal of the current frequency block.
subtotal_recurring_frequency Specifies the recurring frequency subtotal of the current frequency block.
subtotal_recurring_price Specifies the recurring price subtotal of the current frequency block
total_title Specifies the title for total field on the current frequency block.
items Array consisting of details of all the items in the cart.
  • catalog_item_id: sys_id of the item in the cart.
  • variables:Object consisting of all the variable names and corresponding values for the item in the cart.
  • quantity: Quantity of the item in the cart.
  • localized_price: Price of the item in local currency.
  • price: Price of the item.
  • localized_recurring_price: Recurring price of the item in local currency.
  • recurring_price: Recurring price of the item.
  • recurring_frequency: Recurring frequency of the item.
  • item_name: Name of the item in the cart.
  • cart_item_id:sys_id of the item in the cart.
  • delivery_time:Delivery time of the item.

If two-step verification is true, the API returns these JSON or XML elements in the response body to describe the request.

Table 6. Elements returned in the response body when two-step checkout is true
Element Description
request_number Specifies the request record number.
request_id Specifies the sys_id of the request.

Sample cURL request

curl "https://instance.service-now.com/api/sn_sc/v1/servicecatalog/items/6690750f4f7b4200086eeed18110c761/checkout_guide" \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{\"items\":[{
  \"sys_id\":\"04b7e94b4f7b4200086eeed18110c7fd\",
  \"variables\":{
    \"acrobat\":\"true\",
    \"Additional_software_requirements\":\"MS Office 2007\"
  },
  \"sysparm_quantity\":\"3\"
},
{
  \"sys_id\":\"e1be6dcb4f7b4200086eeed18110c74c\"
},
{
  \"sys_id\":\"186d917a6fab7980575967ddbb3ee4f2\",
  \"variables\":{
    \"new_email\":\"abel.tuter@example.com\"
  }
},
{
  \"sys_id\":\"8b3ae7fedc1be1004ece5c08239e522b\"
},
{
  \"sys_id\":\"962967674ff38200086eeed18110c7e7\",
  \"variables\":{
    \"ergonomic_office\":\"Office chair should have lumbar support\"
  }
}]}" \
--user 'admin':'admin'
<!--Case-1: if two-step is false:-->
{
  "result": {
    "cart_id": "0d8c7a32c3211200d68d3b0ac3d3aeba",
    "subtotal_price": "$3,350.00",
    "subtotal_recurring_frequency": "",
    "subtotal_recurring_price": "$300.00",
    "total_title": "Total",
    "monthly": {
      "subtotal_price": "$50.00",
      "subtotal_recurring_frequency": "Monthly",
      "subtotal_recurring_price": "$0.00",
      "total_title": "Total",
      "items": [
        {
          "catalog_item_id": "90af095bcd38798071a208d710d1b64f",
          "variables": {},
          "quantity": "1",
          "localized_price": "$50.00",
          "price": "$50.00",
          "recurring_frequency": "Monthly",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "Belkin iPad Mini Case",
          "cart_item_id": "cb6e485fc3211200d68d3b0ac3d3ae35",
          "delivery_time": "2 Days"
        }
      ],
      "show_subtotal_price": "true",
      "subtotal_title": "Subtotal"
    },
    "none": {
      "subtotal_price": "-",
      "subtotal_recurring_frequency": "",
      "subtotal_recurring_price": "$0.00",
      "total_title": "Total",
      "items": [
        {
          "catalog_item_id": "186d917a6fab7980575967ddbb3ee4f2",
          "variables": {
            "Preferred Email address": "abel.tuter@example.com"
          },
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "New Email Account",
          "cart_item_id": "17c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "global.Workflow"
        },
        {
          "catalog_item_id": "8b3ae7fedc1be1004ece5c08239e522b",
          "variables": {},
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "Corp VPN",
          "cart_item_id": "97c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "2 Days"
        },
        {
          "catalog_item_id": "e1be6dcb4f7b4200086eeed18110c74c",
          "variables": {},
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "External Monitor",
          "cart_item_id": "d3c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "2 Days"
        },
        {
          "catalog_item_id": "962967674ff38200086eeed18110c7e7",
          "variables": {
            "Please describe any ergonomic requirements\n\t\t": "Office chair should have lumbar support"
          },
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "Desk Set Up",
          "cart_item_id": "d7c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "5 Days"
        }
      ],
      "show_subtotal_price": "false",
      "subtotal_title": "Subtotal"
    },
    "yearly": {
      "subtotal_price": "$3,300.00",
      "subtotal_recurring_frequency": "Annually",
      "subtotal_recurring_price": "$300.00",
      "total_title": "Total",
      "items": [
        {
          "catalog_item_id": "04b7e94b4f7b4200086eeed18110c7fd",
          "variables": {
            "Adobe Photoshop": "",
            "Adobe Acrobat": "true",
            "Optional Software": "",
            "Additional software requirements": "MS Office 2007"
          },
          "quantity": "3",
          "localized_price": "$1,100.00",
          "price": "$1,100.00",
          "recurring_frequency": "Annually",
          "localized_recurring_price": "$100.00",
          "recurring_price": "$100.00",
          "item_name": "Standard Laptop",
          "cart_item_id": "9fc5241fc3211200d68d3b0ac3d3ae7e",
          "delivery_time": "5 Days"
        }
      ],
      "show_subtotal_price": "true",
      "subtotal_title": "Subtotal"
    },
    "show_subtotal_price": "true",
    "subtotal_title": "Subtotal"
  }
}

Case-2: if two-step is true:
{
  "result": {
    "request_number": "REQ0010001",
    "request_id": "82a7e89fc3211200d68d3b0ac3d3ae0a"
  }
}

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/6690750f4f7b4200086eeed18110c761/checkout_guide'

# 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.post(url, auth=(user, pwd), headers=headers ,data="{\"items\":[{
  \"sys_id\":\"04b7e94b4f7b4200086eeed18110c7fd\",
  \"variables\":{
    \"acrobat\":\"true\",
    \"Additional_software_requirements\":\"MS Office 2007\"
  },
  \"sysparm_quantity\":\"3\"
},
{
  \"sys_id\":\"e1be6dcb4f7b4200086eeed18110c74c\"
},
{
  \"sys_id\":\"186d917a6fab7980575967ddbb3ee4f2\",
  \"variables\":{
    \"new_email\":\"abel.tuter@example.com\"
  }
},
{
  \"sys_id\":\"8b3ae7fedc1be1004ece5c08239e522b\"
},
{
  \"sys_id\":\"962967674ff38200086eeed18110c7e7\",
  \"variables\":{
    \"ergonomic_office\":\"Office chair should have lumbar support\"
  }
}]}")

# 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)
Case-1: if two-step is false:
{
  "result": {
    "cart_id": "0d8c7a32c3211200d68d3b0ac3d3aeba",
    "subtotal_price": "$3,350.00",
    "subtotal_recurring_frequency": "",
    "subtotal_recurring_price": "$300.00",
    "total_title": "Total",
    "monthly": {
      "subtotal_price": "$50.00",
      "subtotal_recurring_frequency": "Monthly",
      "subtotal_recurring_price": "$0.00",
      "total_title": "Total",
      "items": [
        {
          "catalog_item_id": "90af095bcd38798071a208d710d1b64f",
          "variables": {},
          "quantity": "1",
          "localized_price": "$50.00",
          "price": "$50.00",
          "recurring_frequency": "Monthly",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "Belkin iPad Mini Case",
          "cart_item_id": "cb6e485fc3211200d68d3b0ac3d3ae35",
          "delivery_time": "2 Days"
        }
      ],
      "show_subtotal_price": "true",
      "subtotal_title": "Subtotal"
    },
    "none": {
      "subtotal_price": "-",
      "subtotal_recurring_frequency": "",
      "subtotal_recurring_price": "$0.00",
      "total_title": "Total",
      "items": [
        {
          "catalog_item_id": "186d917a6fab7980575967ddbb3ee4f2",
          "variables": {
            "Preferred Email address": "abel.tuter@example.com"
          },
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "New Email Account",
          "cart_item_id": "17c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "global.Workflow"
        },
        {
          "catalog_item_id": "8b3ae7fedc1be1004ece5c08239e522b",
          "variables": {},
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "Corp VPN",
          "cart_item_id": "97c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "2 Days"
        },
        {
          "catalog_item_id": "e1be6dcb4f7b4200086eeed18110c74c",
          "variables": {},
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "External Monitor",
          "cart_item_id": "d3c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "2 Days"
        },
        {
          "catalog_item_id": "962967674ff38200086eeed18110c7e7",
          "variables": {
            "Please describe any ergonomic requirements\n\t\t": "Office chair should have lumbar support"
          },
          "quantity": "1",
          "localized_price": "$0.00",
          "price": "$0.00",
          "recurring_frequency": "",
          "localized_recurring_price": "$0.00",
          "recurring_price": "$0.00",
          "item_name": "Desk Set Up",
          "cart_item_id": "d7c5241fc3211200d68d3b0ac3d3ae7f",
          "delivery_time": "5 Days"
        }
      ],
      "show_subtotal_price": "false",
      "subtotal_title": "Subtotal"
    },
    "yearly": {
      "subtotal_price": "$3,300.00",
      "subtotal_recurring_frequency": "Annually",
      "subtotal_recurring_price": "$300.00",
      "total_title": "Total",
      "items": [
        {
          "catalog_item_id": "04b7e94b4f7b4200086eeed18110c7fd",
          "variables": {
            "Adobe Photoshop": "",
            "Adobe Acrobat": "true",
            "Optional Software": "",
            "Additional software requirements": "MS Office 2007"
          },
          "quantity": "3",
          "localized_price": "$1,100.00",
          "price": "$1,100.00",
          "recurring_frequency": "Annually",
          "localized_recurring_price": "$100.00",
          "recurring_price": "$100.00",
          "item_name": "Standard Laptop",
          "cart_item_id": "9fc5241fc3211200d68d3b0ac3d3ae7e",
          "delivery_time": "5 Days"
        }
      ],
      "show_subtotal_price": "true",
      "subtotal_title": "Subtotal"
    },
    "show_subtotal_price": "true",
    "subtotal_title": "Subtotal"
  }
}

Case-2: if two-step is true:
{
  "result": {
    "request_number": "REQ0010001",
    "request_id": "82a7e89fc3211200d68d3b0ac3d3ae0a"
  }
}