ServiceNow Authenticate an Element

You can authenticate with ServiceNow to create your own instance of the ServiceNow element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the ServiceNow platform.

Authenticate Through the UI

Use the UI to authenticate with ServiceNow and create an element instance as described in Authenticate an Element Instance (UI). In addition to the base authentication parameters, you will need the credentials that you identified in API Provider Setup.

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Use the /instances endpoint to authenticate with ServiceNow and create an element instance. If you are configuring events, see the Events section.

Note: The endpoint returns an element token upon successful completion. Retain the token for all subsequent requests involving this element instance.

To create an element instance:

  1. Construct a JSON body as shown below (see Parameters):

    {
      "element": {
        "key": "servicenow"
      },
      "configuration": {
        "username": "<USERNAME>",
        "password": "<PASSWORD>",
        "servicenow.subdomain": "<SUBDOMAIN>",
        "filter.response.nulls": true
      },
      "tags": [
        "<Add_Your_Tag>"
      ],
      "name": "<INSTANCE_NAME>"
    }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token and id in the response and save them for all future requests using the element instance.

Example cURL


curl -X POST  \
 -H 'Authorization: User <INSERT>, Organization <INSERT>'  \
 -H 'Content-Type: application/json'  \
 --data '{ \
  "name": "My_ServiceNow", \
  "configuration": { \
    "filter.response.nulls": "true", \
    "username": "username", \
    "password": "******", \
    "servicenow.subdomain": "dev12345" \
  } \
}'  \
'https://api.cloud-elements.com/elements/api-v2/elements/145/instances'

Parameters

API parameters not shown in Cloud Elements are in code formatting.

Note: Event related parameters are described in Events.
ParameterDescriptionData Type
keyThe element key.
servicenow
string
Name
name
The name for the element instance created during authentication.string
Username
username
Your ServiceNow user name.
Password
password
Your ServiceNow password.string
The ServiceNow Subdomain
servicenow.subdomain
This is the part of your URL that is specific to your organization, for example in https://domain12345.service-now.com/ domain12345 is the subdomainstring
Filter null values from the response
filter.response.nulls
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values.
Default: true.
boolean
tagsOptional. User-defined tags to further identify the instance.string

Example Response

{
  "id": 427251,
  "name": "My_ServiceNow",
  "createdDate": "2017-06-06T22:26:22Z",
  "token": "kt6uJ77QG1iCIZNgRvl/BcpJL/JS94sBwwQdicNRZ5s=",
  "element": {
    "id": 145,
    "name": "ServiceNow",
    "hookName": "ServiceNow",
    "key": "servicenow",
    "description": "ServiceNow is changing the way people work, offering service management for every department in the enterprise including IT, human resources, facilities & more.",
    "image": "https://pbs.twimg.com/profile_images/378800000041139697/cf1e6299ecb533ed82725abe96bb96a9_400x400.png",
    "active": true,
    "deleted": false,
    "typeOauth": false,
    "trialAccount": false,
    "resources": [],
    "transformationsEnabled": true,
    "bulkDownloadEnabled": true,
    "bulkUploadEnabled": true,
    "cloneable": true,
    "extendable": true,
    "beta": false,
    "authentication": {
      "type": "basic"
    },
    "extended": false,
    "hub": "helpdesk",
    "protocolType": "http",
    "parameters": [
      {
        "id": 11,
        "createdDate": "2015-04-26T16:11:49Z",
        "name": "servicenow.subdomain",
        "vendorName": "subdomain",
        "type": "configuration",
        "vendorType": "path",
        "source": "request",
        "elementId": 145,
        "required": false
      }
    ],
    "private": false
  },
  "elementId": 145,
  "provisionInteractions": [],
  "valid": true,
  "disabled": false,
  "maxCacheSize": 0,
  "cacheTimeToLive": 0,
  "configuration": {
    "base.url": "https://{subdomain}.service-now.com/api/now/v1/table",
    "bulk.add_metadata": "false",
    "event.notification.subscription.id": null,
    "bulk.query.field_name": "sys_updated_on",
    "pagination.max": "200",
    "servicenow.subdomain": "subdomain123",
    "event.vendor.type": "polling",
    "bulk.query.operator": ">=",
    "filter.response.nulls": "true",
    "bulk.query.date_mask": "yyyy/MM/dd HH:mm:ss",
    "bulk.attribute.created_time": "sys_created_on",
    "bulk.query.download_format": "json",
    "password": "********",
    "bulk.relations": "{}",
    "pagination.type": "offset",
    "event.poller.refresh_interval": "15",
    "event.notification.callback.url": null,
    "event.notification.signature.key": null,
    "event.poller.configuration": "{}",
    "username": "username",
    "event.notification.enabled": "false"
  },
  "eventsEnabled": false,
  "traceLoggingEnabled": false,
  "cachingEnabled": false,
  "externalAuthentication": "none",
  "user": {
    "id": 1234567
  }
}