You can programmatically add records to a table in ServiceNow by creating a POST API for the table. This article will show you how to use Postman to create and test a POST table API.

For clarity, screenshots are added at each stage.

Step 1. Open ServiceNow and navigate to the Table

  1. Open your ServiceNow instance and log in.
  2. Locate the table for which you wish to develop the API using the Application Navigator if you'd like to use a different table.
  3. Go to Tables under System Definition.
  4. To create a custom table, click New.
  5. Name the table and specify its fields.
    ServiceNow

Step 2. Give the Table API Access

  1. Go to System Definition > Tables to open the table configuration.
  2. Find your table and pick it.
  3. Enable the Allow Access via Web Services option in the table settings to make sure the table may be accessed via an API.
  4. Click "Save."

Step 3. Create the POST API

  1. Go to REST API Explorer under System Web Services.
  2. From the dropdown menu, choose the table you wish to work with.
  3. Select the HTTP method POST.
    Rest API
  4. Define the JSON payload in the Request Body section, like below.
    { 
    "short_description" : "Testing post" , 
    "description" : "Testing post" 
    }
  5. To test the API in ServiceNow, click Send.

Step 4. Set up authentication for the API

Step 5. Use Postman to test the API

1. Make a fresh request

2. Establish Headers

Add the following to the Headers tab.

3. Include Authentication

4. Include the payload in JSON

5. Send the Request

Click Send to execute the request.

Step 6. Confirm the Answer

  1. Look for the status code in the Postman response window. A 201 Created answer will be returned if the request is successful.
  2. The information about the newly generated record, including the sys_id, will be included in the response body.
    Response body

Step 7. Verify the ServiceNow record

  1. Return to ServiceNow and navigate back to the table.
  2. Check to see if the values in the JSON payload were used to build the new record.
    Record

Best practices

In the next article, let's see how to handle these parameters dynamically from a diff service instance; until then, bye happy learning.