ServiceNow API Incident Integration | REST API Examples 2024

In this article, we will share how to do integration using ServiceNow API or ServiceNow REST API. ServiceNow provides a number of methods (SOAP, REST API), JDBC, LDAP, Data Export, Email, CTI through which it can be integrated with other tools like Event Monitoring Tools – Netcool, Jira, Slack. ServiceNow Integration using REST API involves request and response.

ServiceNow API

Query Parameters

sysparm_query: An encoded query string used to filter the results.

sysparm_display_value: Return field display values (true), actual values (false), or both (all) (default: false).

sysparm_exclude_reference_link: True to exclude Table API links for reference fields (default: false).

sysparm_suppress_pagination_header: True to suppress pagination header (default: false).

sysparm_fields: A comma-separated list of fields to return in the response.

sysparm_limit: The maximum number of results returned per page (default: 10,000).

sysparm_view: Render the response according to the specified UI view (overridden by sysparm_fields).

sysparm_query_category: Name of the query category (read replica category) to use for queries.

sysparm_query_no_domain: True to access data across domains if authorized (default: false).

sysparm_no_count: Do not execute a select count(*) on table (default: false).

ServiceNow API Examples

In this section, we will share the list of API which are mostly used during integration. Incident table API is one of the most used API.

ServiceNow Incident Management API

servicenow incident management api

Create Incident

API: https://instance-name.com/api/now/table/incident

Method: POST

Strategy: First you need to analyze how many fields are mandatory on the incident and based on that you can create your request. Do not forget to store the correlation_id of the other system this helps manage the one-to-one relationships and will be used for reporting and other references.

You can also use query parameters to limit the number of fields send as a response

Example: https://instance-name.com/api/now/table/incident?sysparm_fields=number, assignment_group, short_description,description, sys_id&sysparm_exclude_reference_link=true

Request

{

"caller_id":"Abel Tuter",

"short_description":"short desc",

"description":"This is description",

"assignment_group":"Database"

"correlation_id":"AXCBGFDHI"

}

 

Response

{
"result": {
"number": "INC0010006",
"short_description": "this is short description",
"sys_id": "3669d61f07123010f1d8f2218c1ed0a9",
"assignment_group": "287ee6fea9fe198100ada7950d0b1b73",
"description": "This is description"
}
}
Update Incident

API: https://instance-name.service-now.com/api/now/table/incident/incident sys_id

Method: PUT

Example: https://instance-name.service-now.com/api/now/table/incident/ 3669d61f07123010f1d8f2218c1ed0a9?sysparm_fields=number,sys_id

Sample request

{
"comments":"test update comments"
}

Sample Response

{
"result": {
"number": "INC0010006",
"sys_id": "3669d61f07123010f1d8f2218c1ed0a9"
}
}
GET Incident

API: https://instance-name.service-now.com/api/now/table/incident?sys_id=incident sys_id

Method: GET

In this example, we will use some query parameters.

API: https://instance-name.service-now.com/api/now/table/incident?sysparm_exclude_reference_link=

true&sys_id=3669d61f07123010f1d8f2218c1ed0a9 &sysparm_fields=number, assignment_group, short_description, description,sys_id

Sample Response

{
"result": [
 {
"number": "INC0010006",
"short_description": "this is short description",
 "sys_id": "3669d61f07123010f1d8f2218c1ed0a9",
"assignment_group": "287ee6fea9fe198100ada7950d0b1b73",
"description": "This is description"
}
]
}

References

Other Important Links

ServiceNow Interview Questions

ServiceNow Admin Interview Questions

ServiceNow Developer Interview Questions

ServiceNow CMDB Interview Questions

ServiceNow Resume Samples Download

Basic Terminology

REST

Representational State Transfer was defined by Roy Fielding in 2000. It is an architectural standard for the world wide web and making easier for systems to communicate with each other.

API

The application programming interface is a software intermediatory that permits two systems to talk to each other. For example, if you are using any messenger or FB messenger and send a message to another user, you are using API.

REST API Response Codes

Informational

Code Meaning
100 Continue
101 Switching Protocols

Successful

Code Meaning
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content

Redirection

Code Meaning
300 Multiple Choices
301 Moved Permanently
302 Found
303 See Other
305 Use Proxy
306 (Unused)
307 Temporary Redirect

Error

Code Meaning
400 Bad Request
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
413 Payload Too Large
414 URI Too Long
415 Unsupported Media Type
417 Expectation Failed
426 Upgrade Required

Server Error

Code Meaning
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

For more info visit ietf

Do let us know if there is any specific ServiceNow API integration you are looking for and we will try to add it in this article. Share your integration experience in comments also, it may help other ServiceNow professionals.

Leave a Comment

error: Content is protected !!