Вы находитесь на странице: 1из 6

Introduction

ServiceNow is a platform-as-a-service (PaaS) provider of enterprise service


management (ESM) software. ServiceNow specializes in delivering ITSM
applications and thus competes with BMC, Computer Associates, IBM, and
Hewlett-Packard.

Basic Concepts
ServiceNow specializes in IT Service Management based on ITIL standards. IT
service management (ITSM) refers to the entirety of activities directed by
policies, organized and structured in processes and supporting procedures that
are performed by an organization or part of an organization to plan, deliver,
operate and control IT services offered to customers.

ServiceNow provides following IT services


Incident Management
Change Management
Problem Management
Service Desk
Incident Alert Management
Knowledge Management
Service Portfolio Management
Service Catalog Management

Using ServiceNow SOAP/REST APIs


ServiceNow exposes SOAP and REST APIs to create, update, find and delete
entities like change, task, incident, problem etc. Every table in ServiceNow has a
corresponding WSDL (for SOAP) which can be leveraged to perform operations on
that table. WSDL format is:
https://<servicenow-instance-name>/<table_name>.do?WSDL
For using REST APIs HTTP Url format along with their corresponding HTTP verbs is
Retrieve Record
GET - https://<service-now-instance-name>/api/now/table/{tableName}

Retrieve a particular record


GET https:// <service-now-instance-name>/api/now/table/{tableName}/{sys_id}

Create Record
POST https:// <service-now-instance-name>/api/now/table/{tableName}

Modify Record
PUT https:// <service-now-instance-name>/api/now/table/{tableName}/{sys_id}

Delete Record
DELETE https:// <service-now-instance-name>/api/now/table/{tableName}/
{sys_id}

Using Demo ServiceNow Environment


ServiceNow has demo and sandbox servicenow accounts which is accessible to
everyone. There URLs are:
https://demo.service-now.com
https://sandbox.service-now.com
However, if you intend to work with SOAP/REST APIs you cannot use those
directly with these URLs. For that you need to go to https://sandbox.servicenow.com
Fill in the required details in the form, accept the terms and conditions and click
Demo Now. You will be redirected to the sandbox ServiceNow instance. In
order to figure out the demo ServiceNow instance server name perform the
following steps.
1. Search for computer keyword and then click on Computer under
System Web Services.
2. On the right panel you can see the url which contains the actual demo
instance server name. In this case it is demo023.service-now.com.
3. This instance name will be used to access all the SOAP/REST services. For
example, for Change the wsdl url will be https://demo023.servicenow.com/change_request.do?WSDL
4. Similarly for using REST API the http url would be https://demo023.servicenow.com/api/now/table/change_request

All ServiceNow demo instances are reset every 24 hours. So all the changes that
you make to these instances will be reset every 24 hours.

Limitations with demo instances


1. Since the demo instances are accessible to everyone and editable as well
changes done by a user can be overridden at any moment.
2. Demo instance cannot send notification emails.
3. Although emails are not sent by demo instances there is a way to see the
format of emails for various notification rules.

Using SOAP Web Services


ServiceNow uses Basic Authentication for authenticating user requests.
Authorization header needs to be set with its value as Basic [Base64 encode
value of {username}:{password}]. For example, if the username and password
are both admin then the header would be
Authorization - Basic YWRtaW46YWRtaW4=
Following is the list of commonly used operations against the WSDL exposed by
ServiceNow tables
1. getKeys

2.
3.
4.
5.
6.
7.
8.

getRecords
get
insert
insertMultiple
update
deleteRecord
deleteMultiple

For detailed information about sample SOAP Envelope requests and responses
please refer to following link - http://wiki.servicenow.com/index.php?
title=SOAP_Direct_Web_Service_API
Use of SOAPAction Header Field
SOAPAction header field needs to be set on the request for all requests made
using SOAP. Its value is equivalent to the name of the operation being executed.
For example in case of insert operations the value of SOAPAction header would
be insert.

Using REST APIs


REST API exposed following operations.

For more details about request parameters and response refer to the following
url - http://wiki.servicenow.com/index.php?title=Table_API

Using Templates
ServiceNow allows using templates for creating entities like change, incident etc.
A template allows creating any entity with pre-defined values of certain
attributes for that entity. Lets take an example of Change. Refer to attached
screenshot.

Here you can see that in the background there is a Create Change form saved
with some values. One can save this is a template as shown above.

As shown above we saved this template with name as change_template.


Now we can use this template while creating a new change as shown below.

Typically enterprises have very complex Change workflows so the use of


templates can be very useful in those scenarios. Having said that Templates
can be used with any table in ServiceNow.

Using Templates in APIs


Using templates to create a change (for example) is a two-step process.
1. Retrieve the values of various fields stored in the template.
2. Set these values while creating a new change record.
Templates are stored in sys_template table in ServiceNow. One can retrieve
contents of any particular template by using getRecords operation on this
table. The values of all the form attributes are stored in template field in the
response. Template field will have the values of attributes in the following form.
approval=approved^assigned_to=5137153cc611227c000bbd1bd8cd2007^assignment_g
roup=287ebd7da9fe198100f92cc8d1d2154e^category=Other^cmdb_ci=b4fd7c84372010
00deeabfc8bcbe5dc1^impact=3^priority=4^requested_by=6816f79cc0a8016401c5a33
be04be441^risk=3^state=1^type=Comprehensive^EQ

All the values are separated by ^ character. This string has to be parsed and
values for different attributes have to be fed in create change request.