The CreatorCon Call for Content is officially open! Get started here.

poornachander
Mega Expert

ServiceNow provides pretty wide variety of technologies to integrate. Here, I am going to discuss about few API integration technologies to integrate with ServiceNow applications and vice versa.

These different options can be used in different places for variety of use-cases. The good point is ServiceNow supports standard protocols such as SOAP and REST, which can be understandable by any other technology(C#, Java, Python) and third party applications such as Remedy, HP CSA and JIRA etc… So technology agnostic API facilitates user to integrate their applications seamlessly with ServiceNow. It's all about what to use where!!!.

So let's start dig into the different API options available within ServiceNow. I have prepared a slide to explain this:

Capture2

Above technology stack diagram explains the API blocks available to ServiceNow. Let us start with Inbound Messaging/Web-service API:

Direct Table WebService

  • A direct web service is available for any table in the system if you configure the correct access control.
  • The whole table can be exposed over a URL & Perform database operations directly on tables.
  • Form Views to Limit/Extend Query Response and ACL controls can be provided.
  • Supported by SOAP / REST / JSONv2 API (GET, POST, PUT, PATCH, DELETE — HTTP methods).
  • This can be implemented Asynchronous with the help of client side SOAP libraries in C# & Java but this completely depends on client tech)
  • Basic Authentication / Cookie based tokens to avoid multiple sessions.
  • For tables not required complex transformation logic & Access any table without having to configure an endpoint.
  • Support JSONv2, CSV, Excel, XML, PDF, and RSS as output formats.

http://wiki.servicenow.com/index.php?title=Web_Service_Import_Sets


Scripted Web Service

  • Custom Web-service interface.
  • Ability to define Input and output data structures / parameters. (no of records etc…) with JavaScript.
  • Arbitrary URL end point can be defined.
  • SOAP only
  • Synchronous
  • Validate, Transform, Enrich and handle any complex logic with scripts.
  • Complex business processes spanned across multiple tables can be handled.
  • Powerful & Performance oriented.
  • Secured and easy to control the access.

http://wiki.servicenow.com/index.php?title=Scripted_Web_Services


ImportSets Approach


Web Service Import Sets provide a web service interface to import set tables. This type of web service will transform the incoming data synchronously based on the associated transform maps by default.

  • The ServiceNow Import Set API provides a REST interface for import set tables.
  • SOAP & REST & JSONv2
  • Transform map will transforms the data and inserts/updates the target table (Incident, Change etc…)
  • Access Control & No direct expose of SN — system tables
  • Complex transformation logic can be implemented with scripts.
  • Flexible to enrich the incoming data (ex: CIs, Incident data reference)
  • Data can be inserted/updated to multiple tables with scripts. (third-party specific, audit etc…)
  • Synchronous / Asynchronous
  • Support JSON, CSV, Excel, and XML as input formats.

http://wiki.servicenow.com/index.php?title=Web_Service_Import_Sets


ECC Queue


By the name says, it's a queue based (actually a table acts like a queue in SNOW).

  • Inbound and outbound
  • Asynchronous
  • Supported with SOAP, REST and JSONv2 APIs
  • Business Rules can trigger on this queue to fire the events or SOAP or REST Messages (outbound) to update client systems
  • MID Server (small java agents) can be used if you have the external system behind the firewalls.
  • Payload can be arbitrary (JSON, XML, CSV, text)

http://wiki.servicenow.com/index.php?title=ECC_Queue


JSONv2


THIS IS NOT ALTERNATIVE TO OTHER API APPROACHES, this can be used instead of SOAP and REST API sets for above explained ways.ServiceNow supports a web service interface that operates on the JSON object as the data input and output format.


  • The JSONv2 web service is provided by a platform-level processor similar to the services for SOAP.
  • Having the JSON object available as a data format for web services means that we can create (insert), update, and query any data in ServiceNow platform using the JSON object format, and get results in the JSON object format.
  • This API, differs from the existing REST API
  • Same as REST API (Supports Direct Table & ImportSet approach )
  • Action Parameters.
  • Basic Authentication.
  • Direct table approach, cannot inject complex transformation logic.

Refer different APIs for above Integration ways

SOAP: http://wiki.servicenow.com/index.php?title=SOAP_Web_Service

REST: http://wiki.servicenow.com/index.php?title=REST_API_Explorer

JSONv2: http://wiki.servicenow.com/index.php?title=JSONv2_Web_Service

These are the conventional API blocks ServiceNow provided. Apart from this if you want to use any complex web services logic to be implemented then PROCESSORS feature can be used, but only if it is for very custom and complex jobs. Refer wiki: http://wiki.servicenow.com/index.php?title=Tutorial_4_Creating_a_Custom_Processor

Outbound Approach from ServiceNow

ServiceNow can communicate to the external systems SOAP or REST end points with API blocks called SOAP Message and REST Messages.

We can configure these features according to   the client's WSDL and data structures and trigger from Work flows, Business Rules by sending the required parameters to call the client's webservices.

Recommendation Matrix:

Capture3

Yes** : Possible but not recommended

Most of the ServiceNow Integration use Import Set API was as it gives the space to the developer to inject complex transformation logic, enrich the data such as looking for CI etc and clean up any iffy data. Unfortunately we cannot use this approach for Get web services such as getting incident status or checking for implementation window triggered or retrieve any CI information, so retrieve methods can be written using Direct Table method, which is recommended for retrieval operations.

Scripted Webservices also gives the flexibility for code behind the URL but it is only supports SOAP as of now. If the business requirement is to load the bulk data import, Import Set tables or ODBC can be used.

External systems synchronization with ServiceNow can be implemented with a combination of these approaches based on the requirements and restrictions.

My recommendation would be Import Set (over REST or JSONv2) and status updates can be via ECC Queue, this can be polled or ServiceNow MID agent or any Shell script can be used to push these messages to external systems.

Happy coding..!!!

2 Comments