1. Web Services Integration – ServiceNow
  2. What is integration?
  3. Type of Integration
  4. Basic Requirements for Integrate any system
  5. Integration Testing Tools
  6. Integration Module
  7. Inbound Integration
  8. SOAP VS REST API
  9. Table API Web Service – REST
  10. Direct web services – SOAP
  11. Import Set Web Service – SOAP
  12. Import Set API – REST
  13. Scripted Web Services – SOAP
  14. Scripted Web Services – REST
  15. SOAP Message – Outbound
  16. REST Message – Outbound
  17. ServiceNow to ServiceNow Incident Integration
  18. OAuth 2.0 Authentication
  19. ServiceNow – OAuth application connect
  20. Access Token VS Refresh Token

Table API Web Service – REST

REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.

Supported HTTP request methods Support for Table API:

  • Retrieve records from a table (GET)
    • Parameterized Get method allow to get data from table
    • Table Name is mandatory, Table name is Path Parameter
    • sysparm_query = Pass query to get data
    • sysparm_limit = to set max count for data set
    • sysparm_fields = to get only defined fields
    • sysparm_display_value = Return field display values (true), actual values (false), or both (all)
    • Example URL : https://<instance>.service-now.com/api/now/table/incident?sysparm_query=active%3Dtrue
  • Create a record (POST)
    • Table Name & Data is mandatory, Table name is Path Parameter
    • Example:https://<instance>.service-now.com/api/now/table/incident
    • Data: {“short_description”:”test”}
  • Retrieve a record (GET)
    • Its return only one record
    • Table Name & sys_id two path parameter are mandatory.
    • Example: https://<instance>.service-now.com/api/now/table/incident/fc598bdc1b991c140a2163166e4bcb8b
  • Modify a record (PUT)
    • Table Name, sys_id & Data is mandatory, Table name is Path Parameter
    • https://<instance>.service-now.com/api/now/table/incident/fc598bdc1b991c140a2163166e4bcb8b
    • Data: {“short_description”:”test”}
  • Delete a record (DELETE)
    • Delete a specific record by sys_id
    • Example: https://<instance>.service-now.com/api/now/table/incident/fc598bdc1b991c140a2163166e4bcb8b
  • Update a record (PATCH)
    • Table Name, sys_id & Data is mandatory, Table name is Path Parameter
    • https://<instance>.service-now.com/api/now/table/incident/fc598bdc1b991c140a2163166e4bcb8b
    • Data: {“short_description”:”test”}

CURL Example:

curl "https://<instance>.service-now.com/api/now/table/incident/fc598bdc1b991c140a2163166e4bcb8b" \
--request DELETE \
--header "Accept:application/json" \
--user 'admin':'admin'

Important Notes in TABLE API

  • Table API doesn’t validation Mandatory and other validation
  • You can use the HEAD methods in place of GET methods to return a response without a response body.
  • You cannot pass multiple records in POST, PUT, and PATCH operations. If you do, only the first record is processed, the rest are ignored.
  • You cannot use POST, PUT, and PATCH to insert or update records into a Database view, as Database views are read-only.

Requirements:

  • Give me all active incidents ?
    • https://dev105176.service-now.com/api/now/table/incident?sysparm_query=active=true
  • Give me all the change request ?
    • https://dev105176.service-now.com/api/now/table/change_request?sysparm_query=state=-5
  • Get 2 Open Incident and return number,short_description and CI Name
    • https://dev105176.service-now.com/api/now/table/change_request?sysparm_query=state=-5&sysparm_limit=2&sysparm_fields=number,short_description,cmdb_ci&sysparm_display_value=all
  • Give me a change request details that I know sys_id and I need only number
    • https://dev105176.service-now.com/api/now/table/change_request/c83c5e5347c12200e0ef563dbb9a7190?sysparm_fields=number
  • Create an Incident
curl --location --request POST 'https://dev105176.service-now.com/api/now/table/incident' \
--header 'Authorization: Basic aW50ZWdyYXRpb24uYWRtaW46Um9oaXRhYmMxMjMh' \
--header 'Content-Type: application/json' \
--data-raw '{"short_description":"test incident 2"}'
  • Update Incident
curl --location --request PUT 'https://dev105176.service-now.com/api/now/table/incident/6d17fb98970a1110477671571153af72' \
--header 'Authorization: Basic aW50ZWdyYXRpb24uYWRtaW46Um9oaXRhYmMxMjMh' \
--header 'Content-Type: application/json' \
--data-raw '{"caller_id":"Integration Admin"}'
  • Delete a record
curl --location --request DELETE 'https://dev105176.service-now.com/api/now/table/incident/6d17fb98970a1110477671571153af72' \
--header 'Authorization: Basic aW50ZWdyYXRpb24uYWRtaW46Um9oaXRhYmMxMjMh' \
--header 'Content-Type: application/json' \

Total Views: 1399

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *