ServiceNow API Integration Overview

REST API Overview #

This document provides various examples of connecting to a ServiceNow REST API from edgeCore. It is written against ServiceNow version Istanbul.

Please see the following link as needed for ServiceNow REST API documentation:
https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/integrate/inbound-rest/concept/c_RESTAPI.html

Instance REST API Explorer:
https://<serviceNow Instance>/nav_to.do?uri=%2F$restapi.do

REST API Authentication #

Access to the ServiceNOW REST API is protected by Basic Authentication.

cURL reference authentication request

curl “https://instance.service-now.com/api/now/table/incident?sysparm_limit=10″ \ –request GET \ –header “Accept:application/json” \ –user ‘admin’:'<adminpw>’

REST API Example Connection Configuration #

edgeCore connects to the ServiceNow REST API using a Web Data Connection. An example Connection Configuration for the ServiceNow REST API is presented below:

Connection Property Example
Connection Name ServiceNow REST API
Destination https://<ServiceNowRestApiEndpoint>
SSO Handler Basic Auth
SSO Credentials Username: <servicenow user>
Password: <servicenow password>

ServiceNow Web UI REST API Authentication #

edgeCore can also make REST API calls to the REST API utilized by the ServiceNow web UI. To do so, copy the ServiceNowRESTSso.js file to the edgeCore <Install_Home>/webrules/generic/sso/ directory. When creating a connection to ServiceNow, set the SSO Handler to ServiceNowRESTSso. 

ServiceNow provides both a supported and unsupported REST API for data requests. The unsupported REST API is used by the native ServiceNow web UI.

Web UI Example Connection Configuration #

An example Connection Configuration for the ServiceNow Web UI REST API is presented below:

Connection Property Example
Connection Name ServiceNow Web UI REST API
Destination https://<ServiceNowRestApiEndpoint>
SSO Handler ServiceNowRESTSso
SSO Credentials Username: <servicenow user>
Password: <servicenow password>

Example Feed Configurations #

edgeCore makes requests to the ServiceNow REST API using the JSON Feed.  Below are defaults for all ServiceNow Feed configuration properties unless otherwise specified:

Default Feed Property Value
Request Headers None
Rule Name BaseData
Logging Production
Poll Period 60
Enable Server Subscription Yes

Listed below are a series of sample JSON Feed Configurations that make requests to the supported ServiceNow REST API:

ServiceNow Get Active Incidents #
Feed Property Value
Feed Name ServiceNow Get Active Incidents
Start URI /api/now/table/incident?sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_limit=1000&active=true
HTTP Method GET
JSON Path $.result
ServiceNow Get Business Services #
Feed Property Value
Feed Property Value
Feed Name ServiceNow Get Business Services
Start URI /api/now/table/cmdb_ci_service?sysparm_exclude_reference_link=true&sysparm_limit=1000
HTTP Method GET
JSON Path

$.results #

Listed below are a series of sample JSON Feed Configurations that make requests to the unsupported ServiceNow REST API:

ServiceNow Get Business Service Nodes #
Feed Property Value
Feed Name ServiceNow Get Business Service Nodes
Start URI /ngbsmprocessor.do?actionType=loadBasic&cacheKill=1476736163076&cmd=get&id={nodeVar.ServiceNowServiceId}&level=5&mapScriptID=&serviceMode=false
HTTP Method GET
JSON Path $.nodes
Feed Property Value
Feed Name ServiceNow Get Business Service Links
Start URI /ngbsmprocessor.do?actionType=loadBasic&cacheKill=1476736163076&cmd=get&id={nodeVar.ServiceNowServiceId}&level=5&mapScriptID=&serviceMode=false
HTTP Method GET
JSON Path $.links