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

This method creates a record and returns the Table API relative path and redirect url to access the created record.

URL format

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

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

Supported request parameters

Table 1. Parameters
Parameter Description
sysparm_view Specifies 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 successful request and returns the response object consisting of Table API and url to access the created record.
404 Requested resource cannot be found.
400 Request is not processed due to incorrect request message.
500 Internal error.

Sample cURL request

curl "https://instance.service-now.com/api/sn_sc/servicecatalog/items/3f1dd0320a0a0b99000a53f7604a2ef9/submit_producer" \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{'variables':{'urgency':'2','comments':'This is sample incident'}}" \
--user 'admin':'admin'
{
"result": {
"record": "api/now/table/incident/1584f89767211200f579794717415a79,
"redirect_url": "incident.do?sys_id=1584f89767211200f579794717415a79&sysparm_view=ess"
}
}

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/items/3f1dd0320a0a0b99000a53f7604a2ef9/submit_producer'
# 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}
response = requests.post(url, auth=(user, pwd), headers=headers ,data="{'variables':{'urgency':'2','comments':'This is sample incident'}}")
# 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>
<record>api/now/table/incident/6db6f89767211200f579794717415a7a</record>
<redirect_url>incident.do?sys_id=6db6f89767211200f579794717415a7a&amp;sysparm_view=ess</redirect_url>
</result>
</response>