Service Catalog API - POST /sn_sc/servicecatalog/cart/submit_order

This method checks out the user cart, whether two-step parameter is enabled or disabled.

URL format

Versioned URL: /api/sn_sc/v1/servicecatalog/cart/submit_order

Default URL: /api/sn_sc/servicecatalog/cart/submit_order

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. 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 completed successfully and the items in the cart are successfully checked out.
400 Indicates that the user cart is empty.

Response body

Table 5. Response body values
Parameter Description
request_number Number of the request generated.
request_id sys_id of the order request generated.

Sample cURL request

curl "https://instance.service-now.com /api/sn_sc/v1/servicecatalog/cart/submit_order " \
--request POST \
--header "Accept:application/json" \
--user 'admin':'admin'
{
    "result": {
        "request_number": "REQ0010010",
        "request_id": "f89ed597db21120064301150f0b8f5ff"
    }
}

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/cart/submit_order '

# 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 = requests.post(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" ?>
<result>
    <request_number>REQ0010010</request_number>
    <request_id>f89ed597db21120064301150f0b8f5ff</request_id>
</result>