How does the system expose API calls and auto creation of incidents/problems automatically

Carol2
Tera Contributor

Hi,

 

Please help with the below requirement. 

 

I need assistance with API integration is still quite new for me. Where do I start with the requirement below and what are the best practices when it comes to API integration.

 


1. Does ServiceNow expose API calls in order to create incidents/problems automatically - Yes 
2. How will this be exposed to the integration team in order to auto-create tickets.
3. What requirements can be shared (Operations, swagger etc) for us to create a test ticket.

 

Regards 

Ca

1 REPLY 1

Anand Kumar P
Giga Patron
Giga Patron

Hi @Carol2 ,

Type Rest api explorer in ServiceNow left navigation and follow below steps 

 

1. Endpoint URL:

 

POST https://<instance_name>.service-now.com/api/now/table/incident

 

2. Authentication

 

Use Basic Authentication or OAuth:

Basic Auth: Provide username and password(create user record in sys_user table prove rest_service role and check webservice checkbox true).

 

or

 

OAuth: Use a token (preferred for secure integration).

 

3. Headers

 

Include these headers in the request:

 

Content-Type: application/json

Accept: application/json

 

4. JSON Payload

 

payload to create an incident:

 

{

  "short_description": "Test Incident via API",

  "description": "Details about the incident",

  "priority": "2",

  "category": "hardware",

  "assignment_group": "IT Support"

}

 

5. Test API Request postman 

 

Open postman lets assume postman as third party to create incident and follow below steps:

1. Set the method to POST.

2. Add the endpoint URL.

3. Set the authentication (Basic or OAuth).

4. Add headers (Content-Type, Accept).

5. Add the JSON payload in the body.

6. Send the request.

 

6. Response

Success response:

{

  "result": {

    "sys_id": "32 bit id of incident record",

    "number": "INC0010001"

  }}

 

Share all details with 3rd party so that they can configure from their end to create records in ServiceNow 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand