In this blog, we will be learning about how to get ServiceNow incident ticket details using OAuth authentication in Postman.
Please follow the below steps:
Register OAuth application in ServiceNow
Before using OAuth in Postman, we must set up an OAuth provider in ServiceNow. Here's how to do that:
1). Log in to your ServiceNow instance as an administrator.
2). Open System OAuth > Application Registry.
3). Click on New and select Create an OAuth API endpoint for external clients.
4). Fill in the necessary fields:
Name: A descriptive name - "Postman OAuth App".
Client ID: A unique identifier for your application.
Client Secret: A secret key generated for your app.
5). Save the record and take note of the Client ID and Client Secret as you'll need them in Postman.
Get OAuth Token in Postman
Once your OAuth application is registered in ServiceNow, you'll use it to obtain an access token in Postman.
1). Open Postman.
2). Set the HTTP Method to POST.
3). Request URL is https://dev29xxxx.service-now.com/oauth_token.do
4). Go to the Body tab.
5). Fill in the details:
Key | Value |
---|---|
grant_type | password |
client_id | 58au69vbbe3771xxx2ab5793c46cd2xxxbb |
client_secret | Vb!2,69C5V|fAU |
username | admin |
password | AwdVmIseR4h*J4@ |
6). Click Send button to obtain the token.
Make a Request to Get Incident Data
1). Open Postman.
2). Set the HTTP Method to GET.
3). Request URL is:
https://dev29xxxx.service-now.com/api/now/table/incident?sysparm_limit=5&sysparm_query=active=true^ORDERBYDESCnumber&caller_id.email=david.miller@example.com&sysparm_fields=number,sys_created_on,urgency,state,short_description
4). Go to the Headers tab.
5). Fill in the details:
Key | Value |
---|---|
Content-Type | application/json |
Accept | application/json |
Access-Control-Allow-Origin | * |
Authorization | Bearer [access_token_value] |
6). Click Send button to obtain the token.
View the Response
If everything is configured correctly, Postman will return a JSON response with the incident data from ServiceNow.
I hope this will help all of you! 🧲
Feel free to provide feedback.