Today I want to introduce the first in a series of example application projects will be hosted on GitHub that illustrate how various types of clients (Web, Mobile, IoT Device, Hybrid) can connect to ServiceNow by using the platform REST APIs and Scripted REST APIs that the ServiceNow platform provides.
These projects will include source code and documentation on how to get setup as well as how the application works so you can quickly check out an example client application that connects to ServiceNow REST APIs. Go ahead and clone the Node.js myworkapp, give it a try and let us know what you think. We’re looking forward to hearing what you think and seeing what you build.
The Node.js myworkapp example app can be found on GitHub under the ServiceNow organization. Look for “example-restclient” in the name and you’ll see that there are currently repos for the myworkapp-nodejs and myworkapp-ios projects. The myworkapp-nodejs is ready for you to take a look at today and in the next few weeks we’ll have the myworkapp-ios example ready. These are the first two example apps in a series we have planned so stay tuned you’ll soon hear about more example apps we are working on.
Each of the example client applications follow the pattern of providing a client application in a different format/language that relies on the same ServiceNow platform REST API and Scripted REST API for their backend. In this way each example app provides a client in a different format/language but all of them user HTTPS to communicate with a ServiceNow instance. For those of you familiar with the TodoMVC you may see the similarity here.
The custom Task Tracker Scripted REST API (included in the repo and available on share) acts as a simple API Gateway providing a REST API that gathers data from various underlying apps/tables in the ServiceNow instance and returns a list of all tasks that are active and assigned to the requestor (based on credentials included in the request). The platform REST Table API is then being used to gather comments for each task and to lookup details about the requesting user. We are using the REST Table API to illustrate that the client application could use multiple APIs to gather data but we could have also chosen to implement all of the functionality in the Task Tracker Scripted REST API.
More about ServiceNow REST APIs
ServiceNow provides REST APIs that allow developers to connect their applications to ServiceNow using protocols (HTTPS) and data formats (JSON/XML) that they expect and are familiar with. In addition to providing platform REST APIs that support CRUD operations on any data table in the platform developers also have the ability to create their own REST APIs (using ServiceNow Scripted REST APIs) that provide custom interfaces for their applications and data.
The ability for developers to create custom REST APIs is a recent addition and was introduced in the ServiceNow Geneva release as Scripted REST APIs. Scripted REST APIs meet customers need to be able to create a custom interface for a variety of reasons including; to integrate with a 3rd party service that didn’t allow flexibility in the format of the request payloads it sent to ServiceNow (e.g., WebHooks, IoT Sensor Posts), to provide an API Gateway style interface for interacting with their applications and data in ServiceNow, to return custom payloads to their WebApps or UI Pages using modern frameworks like AngularJS or KnockoutJS, to provide custom interfaces to meet their customers needs.
You can find out more about ServiceNow, ServiceNow REST APIs, and our developer program via the following links: