top of page

Setting Up OAuth for ServiceNow Table API in Postman

OAuth (Open Authorization) is a secure way to allow applications to access resources on behalf of a user without exposing their credentials. This guide will walk you through setting up OAuth for ServiceNow Table API and configuring Postman to use OAuth tokens for making API requests. As a mockup feel free to use use our project in Postman


Prerequisites:

  1. ServiceNow Instance with admin

  2. Postman installed on your system or cloud - depends if the instance is available internally or public

  3. Administrator access to ServiceNow for setting up OAuth.


Step 1: Create an OAuth Application Registry in ServiceNow

  1. Log into your ServiceNow instance as an admin.

  2. Navigate to System OAuth > Application Registry.

  3. Click on New to create a new OAuth application.

  4. Select Create an OAuth API endpoint for external clients.


Configure the OAuth Application:

  • Name: Give your application a meaningful name (e.g., Postman OAuth).

  • Client ID: A unique identifier for your application. You can leave this blank to auto-generate.

  • Client Secret: A secret known only to the application and the authorization server. Click the lock icon to generate one.

  • Redirect URL: This is the callback URL where the authorization code will be sent. For Postman, use https://oauth.pstmn.io/v1/callback.

Save the record and note down the Client ID and Client Secret.


Step 2: Assign Roles to the OAuth Application

  1. Navigate to System OAuth > Application Registry and open the OAuth application you created.

  2. Scroll down to the Application Roles related list and click on New.

  3. Add the necessary roles that your application will need to access ServiceNow resources, such as rest_api_explorer, snc_internal or any specific roles required for accessing target tables.


Step 3: Get an OAuth Token Using Postman

  1. Open Postman and create a new request.

  2. Go to the Authorization tab.

  3. Select OAuth 2.0 as the type.

  4. Click on Get New Access Token.


Configure the Token Settings:

  • Token Name: A name for your token (e.g., ServiceNow Token).

  • Grant Type: Authorization Code.

  • Callback URL: https://oauth.pstmn.io/v1/callback.

  • Auth URL: https://<instance_name>.service-now.com/oauth_auth.do.

  • Access Token URL: https://<instance_name>.service-now.com/oauth_token.do.

  • Client ID: The Client ID from your ServiceNow OAuth application.

  • Client Secret: The Client Secret from your ServiceNow OAuth application.

  • Scope: Leave this blank or specify any scopes required by your application.

  • State: A unique identifier to maintain the state between the request and callback.

Click on Request Token. You will be redirected to the ServiceNow login page. Log in with your ServiceNow credentials and authorize the application. Postman will automatically handle the callback and fetch the access token.


Step 4: Use the OAuth Token in Postman Requests

  1. In the Authorization tab of your Postman request, select OAuth 2.0 as the type.

  2. Use the token you obtained in the previous step. You can select it from the dropdown menu in the Available Tokens section.


Step 5: Make API Requests Using OAuth Token

Now, you can make API requests to the ServiceNow Table API using the OAuth token.


Example: Get Records

  1. Create a new request in Postman.

  2. Set the request type to GET.

  3. Use the following URL format: plaintext

  4. Copy code https://<instance_name>.service-now.com/api/now/table/<table_name>?sysparm_query=<query>

  5. In the Authorization tab, select OAuth 2.0 and ensure your token is selected.

  6. Send the request.


Summary

If you have any questions or run into issues reach us out for further assistance. Also we have own Table API project free to share to so you don't have to reinvent the wheel. STREYDA's workspace

Comments


Commenting has been turned off.
bottom of page