The Import Set API provides endpoints that allow you to interact with import set tables.

This API transforms incoming data based on associated transform maps. The import set API supports synchronous transforms. The Import Set API mirrors the existing SOAP interface.

Security

Access to tables via the REST API is restricted by BasicAuth. To allow access to tables without any authentication or authorization, add the table name to sys_public.list. ACLs defined on tables are still enforced, and it is the administrator's responsibility to deactivate ACLs.

Import Set - GET /now/import/{stagingTableName}/{sys_id}

Retrieves the specified import staging record and resulting transformation result.

URL format

Versioned URL: /api/now/{api_version}/import/{stagingTableName}/{sys_id}

Default URL: /api/now/import/{stagingTableName}/{sys_id}

Supported request parameters

Table 1. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

stagingTableName Name of the table from which to obtain the import data.

Data type: String

sys_id Sys_id of the record that contains the data.

Data type: String

Table 2. Query parameters
Name Description
None
Table 3. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 4. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 5. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Response body parameters (JSON or XML)

Example: Sample cURL request

curl "https://instance.servicenow.com/api/now/import/imp_user/e2928be64f411200adf9f8e18110c777" \
--request GET \
--header "Accept:application/json" \
--user "username":"password"
{
  "import_set": "ISET0010001",
  "staging_table": "imp_user",
  "result": [
    {
      "transform_map": "User",
      "table": "sys_user",
      "display_name": "name",
      "display_value": "John Public",
      "record_link": "https://instance.service-now.com/api/now/table/sys_user/ea928be64f411200adf9f8e18110c777",
      "status": "inserted",
      "sys_id": "ea928be64f411200adf9f8e18110c777"
    }
  ]
}

Import Set - POST /now/import/{stagingTableName}

Inserts incoming data into a specified staging table and triggers transformation based on predefined transform maps in the import set table.

Transformation occurs synchronously. For each transform map that you define, the responses include transformation results such as information on the target records.
Note: The status_message and error_message fields on transformation scripts are processed and returned in response, along with any custom response fields.

URL format

Versioned URL: /api/now/{api_version}/import/{stagingTableName}

Default URL: /api/now/import/{stagingTableName}

Supported request parameters

Note: The Import Set POST method accepts only name-value pairs of String data types in request body parameters. If any other data type is provided, the resulting value stored in the import set table might not conform to the intended format. For example, the ":" notion of the nested JSON object is changed to "=".
Table 7. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

stagingTableName Name of the table from which to import the data.

Data type: String

Table 8. Query parameters
Name Description
None
Table 9. Request body parameters (XML or JSON)
Name Description
Call specific Name-value pairs to insert in the import fields.

Data type: String

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 10. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Content-Type Data format of the request body. Supported types: application/json or application/xml.

Default: application/json

Table 11. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Response body parameters (JSON or XML)

NameDescription
import_set Name of the import set.

Data type: String

result List of objects that contain information on the data sets that were imported.
Data type: Array
"result": [
  {
    "display_name": "String",
    "display_value": "String",
    "record_link": "String",
    "status": "String",
    "sys_id": "String",
    "table": "String",
    "transform_map": "String"
  }
]
result.display_name Display name of the import set.

Data type: String

result.display_value Value of the import set.

Data type: String

result.record_link Table API GET request for the imported record.

Data type: String

result.status Status of the import.

Data type: String

result.sys_id Sys_id of the import record.

Data type: String

result.table Name of the table in which the data was imported.

Data type: String

result.transform_map Name of the transform map.

Data type: String

staging_table Name of the import staging table.

Data type: String

Example: Sample cURL request

curl "https://instance.servicenow.com/api/now/import/imp_user" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{'first_name':'John','last_name':'Public','user_id':'john.public','email':'john.public@company.com'}" \
--user "username":"password"
{
  "import_set": "ISET0010001",
  "staging_table": "imp_user",
  "result": [
    {
      "transform_map": "User",
      "table": "sys_user",
      "display_name": "name",
      "display_value": "John Public",
      "record_link": "https://instance.servicenow.com/api/now/table/sys_user/ea928be64f411200adf9f8e18110c777",
      "status": "inserted",
      "sys_id": "ea928be64f411200adf9f8e18110c777"
    }
  ]
}

Import Set - POST /now/import/{stagingTableName}/insertMultiple

Inserts multiple records into a specified staging table and triggers transformation based on predefined transform maps or Robust Transform Engine (RTE) configurations in a single request.

Transformation is asynchronous by default. To set synchronous transformation, create a new record in the Rest Insert Multiples [sys_rest_insert_multiple] table, select the source table, and set the transformation to synchronous.

This endpoint can send a request body in two possible formats.
Data source file format
If you generate a staging table from a JSON data source, match the JSON format of the source file.
Staging table column format
Default. Matches the staging table column request body format in key value pairs.

URL format

Versioned URL: /api/now/{api_version}/import/{stagingTableName}/insertMultiple

Default URL: /api/now/import/{stagingTableName}/insertMultiple

Supported request parameters

Note: The Import Set POST method accepts only name-value pairs of String data types in request body parameters. If any other data type is provided, the resulting value stored in the import set table might not conform to the intended format. For example, the ":" notion of the nested JSON object is changed to "=".
Table 13. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

stagingTableName Name of the import set table from which to import the data. Refer to Import sets key concepts.

Data type: String

Table 14. Query parameters
Name Description
multi_import_set_id Sys_id of an entry in the Multi Import Sets [sys_multi_import_set] table. If specified, adds the current import to this multiple import set instead of adding to a new multiple import set.

Data type: String

run_after Sys_id of an entry in the Import Sets [sys_import_set] table. Enables running the current import set after the specified import set is complete. You can use this parameter to enforce the sequential order of imports.

This parameter is only valid in asynchronous transformations.

Data type: String

Table 15. Request body (JSON)
Format Description
Data source file This request body format matches the JSON file format used to create the data source. Provide the request body in the same format as the JSON in the data source. JSON input varies depending on the properties in your data source. Refer to JSON information in File type data source.
  • This option is only available if the staging table was created using a JSON data source. Refer to Create a File type data source.
  • You must define the path of the data source in the Data Source [sys_data_source] table in the Path for each row field.
  • To change the default behavior for the REST Insert Multiple user, create an entry in the REST Insert Multiples [sys_rest_insert_multiple] table.
  • Enable the Use data source format in the REST insert multiple entry.

Data type: Object

Staging table column (default) This request body format matches staging table columns. Use the records array of key-value pairs matching the staging table column to insert in the import fields. Each JSON key is maps the table column to a JSON value representing the value to be inserted. JSON input varies depending on what fields are in your staging table.

The column mapping default key value is to the column table.

{
   "records":[
      {
         "<ColumnLabel1>":"<value>",
         "<ColumnLabel2>":"<value>"
      },
      {
         "<ColumnLabel1>":"<value>",
         "<ColumnLabel2>":"<value>"
      }
   ]
}
You can modify mapping settings by adding an entry in the Rest Insert Multiples [sys_rest_insert_multiple] table and changing the Column mapping from Label to Column name.
{
   "records":[
      {
         "<column_name1>":"<value>",
         "<column_name2>":"<value>"
      },
      {
         "<column_name1>":"<value>",
         "<column_name2>":"<value>"
      }
   ]
}

The Data dictionary tables provides details on table fields in the system.

Data type: Array

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 16. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Only supports application/json.
Table 17. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Response body (JSON)

Name Description
import_set_id Sys_id of the record added to the Import Sets [sys_import_set] table. For asynchronous requests, you can use this value to run another import set after this import set process is complete.

Data type: String

multi_import_set_id Sys_id of the record added to the Multi Import Sets [sys_multi_import_set] table. This value can be used to group multiple import sets into one set.

Data type: String

Example: Sample cURL request

The following example shows how to run a transform on an import table called u_employee_import_set_table using the staging table column format.

curl "https://instance.servicenow.com/api/now/import/u_employee_import_set_table/insertMultiple" \
--request POST \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{
  \"records\": [
  {
   \"Address\": \"Hollywood\",
   \"Name\": \"Tom\",
   \"ID\": \"123\"
  },
  {
   \"Address\": \"Vine\",
   \"Name\": \"Irene\",
   \"ID\": \"456\"
  }
  ]
}" \
--user 'username':'password'

Results include sys_ids for new records in the Import Sets [sys_import_set] and Multi Import Sets [sys_multi_import_set] tables.

{
  "import_set_id": "<import_set_sys_id>",
  "multi_import_set_id": "<multi_import_set_sys_id>"
}