Wednesday, March 16, 2016

Working with Import Set API in Service Now


What is ServiceNow?

ServiceNow is a software platform that supports IT service management and automates common business processes. This software as a service (SaaS) platform contains a number of modular applications that can vary by instance and user.

ServiceNow has two types of APIs such as SOAP and REST API. Most functions are same in those two APIs. ServiceNow offers three types of REST APIs such as Table API, Aggregate API and Import set API. There are some methods and tables in those APIs.

Accessing Import Set API differ from other APIs because we cannot directly access the records in import set tables. We have to give ACL permission for that. This blog illustrates about Import Set API.

What is Import Set API?

The ServiceNow Import Set API provides a REST interface for import set tables. The API transforms incoming data based on associated transform maps. The import set API supports synchronous transforms. Access to tables via the REST API is restricted by BasicAuth and the rest_service ACL

Import Set API provides two methods such as POST record and GET record by sys_id. When you create an instance four tables will be provided such as imp_computer, imp_location, imp_notification and imp_user. You can create your own tables also. The user should have rest_service role to access above two methods.

In this blog, I am discussing about how to give access to the table imp_computer and  create an exclusive ACL for rest_service role.

Giving Application Access to the records in the table
1. Go to the link "https://instancename.service-now.com/imp_computer_list.do " Here you have to specify your own instance name. After that below page will be displayed.
2. Then Right Click->Configure->Table


3. Then  a window like below will ,appear. In this window you can check the check box "can create", "can read", "can update" and "can delete" according to your requirement.

Create an exclusive ACL for rest_service role, giving access to the table

Before creating ACL for rest_service role, we have to create rest_service role for the user.
1. Elevating to a privileged role: For this type as "roles" in your filter of the instance. Then click on the Roles which appear in the list (left panel). Following window will appear. 


Then make Elevated privilege as true to security_admin

 After that click on a lock icon Icon-elevated.png which appears next to the user's name in the header.

 Then a pop up window will appear. In that window you have to tick security_admin.

2. Navigate to System Security > Access Control (ACL) in your instance. Following window will appear.

3. Click New.
4.Define the object the ACL rule secures and the permissions required to access the object. Put a read ACL for rest_service role- you should have security_admin role to create new ACLs: Incident.none and Incident.*



Now you have given ACL permission for that record. Then you can access Get Record by specifying sys_id method can be accessed.

The sys_id that is returned during a POST call to an import set table is not the sys_id of the record in the import set table.  It is the sys_id in the target table(where the record was transformed to)

To get the sys_id, as an admin, you have a multitude of options

Option 1: Navigate to the record (https://instancename.service-now.com/imp_computer_list.do) in a list, right click and copy sys_id.




Option 2: Open the record in a new window, without the frames.  The URL will contain the sys_id


Option 3: While in the record, right click on the header, select show XML, and find sys_id in there.



After getting the sys_id go to REST API Explorer by typing "rest" in the filter in your instance.

Then specify the table name as "imp_computer" and your copied sys_id and click send.

The Response message will like below.




3 comments:

  1. ServiceNow is a software platform that supports IT service management and automates common business processes. For training on ServiceNow check this site Tekslate.

    ReplyDelete
  2. the article provided by you is very nice and it is very helpful to know the information about servicenow ..i found a article related to you..once you can check it out
    servicenow online training

    ReplyDelete