REST API explorer elements

The REST API Explorer displays multiple elements that allow you to construct and test REST requests.

The Namespace, API, method, Request Headers and Path Parameters sections appear for all requests. Other sections may appear depending on the selected API and method.

Namespace, API, and method

The choice lists at the top of the REST API Explorer allow you to select an API, such as the Table API, Aggregate API, or Import Set API, and an API version. Available APIs depend on the selected Namespace. REST APIs provided by ServiceNow use the now namespace. Scripted REST Services may use a different namespace.

Links that appear below these choice lists display available methods for the selected API and version, such as the GET method for the Table API. Each method includes a brief description of the action that method performs. The REST API Explorer displays a sample endpoint and certain Request Elements based on the selected API and method.

Request headers

In the Request Headers section, specify the HTTP request and response headers.

To add a custom header, click Add custom header and specify the header name and value.

Path parameters

In the Path Parameters section, select the table to interact with. For the Import Set API, import staging tables are available. For the Table API and Aggregate API, all tables that allow web service interaction are available. For requests that interact with a single existing record, such as those that modify a record, the sys_id field allows you to specify the record.

Query parameters

In the Query Parameters section, define parameters to modify the request, such as the encoded query used to filter results when performing a Table API GET request.

The parameters that appear depend on the selected request method. To add custom query parameters, click Add query parameter and specify the parameter name and value. Refer to the documentation for each REST API method for detailed information about the available parameters.

Request body

In the Request Body section, define the body content of the request. This section appears for methods that insert or update data, such as PUT. The Request Format that you select in the Request Headers section determines the format you must use in the request body, such as JSON or XML.

You can build the request body by selecting fields, by manually writing the request body, or by uploading a binary file.

Use the Builder tab to build the request body using instance fields. Click Add a field, then select a field and specify a value. Available fields depend on the table you are adding data to.

Use the Raw tab to manually enter a request body.

Use the Binary tab to upload a binary file. This tab appears only for APIs that support binary file data, such as the Attachment API.

Code samples

You can obtain a code sample in various languages that you can use to send the request. Links for code samples appear at the bottom of the form. Click a link to view or copy the code sample for that language. The code samples change based on data you enter on the form. Code samples are available in these languages:
  • ServiceNow Script
  • cURL
  • Python
  • Ruby
  • JavaScript
  • Perl
  • Powershell

Request and response details

After sending a request, the Request and Response sections appear providing detailed information including the full request URI, headers for both the request and response, the HTTP status code of the response, and the response body. Click Clear Response to hide this information.

When testing a request that returns a binary response, such as a file attachment, the REST API Explorer uses the browser default functionality to handle the file, such as by prompting you to download the file.