CMDB Data Ingestion API
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- API reference
The CMDB Data Ingestion API provides endpoints that enable the batch ingestion of an array of objects into an Import Set table.
In addition, this API won't work by default for zbooted instances.
This API is activated through the Configuration Management Database (CMDB) (com.snc.cmdb) plugin and requires the cmdb_import_api_admin role.
CMDB Data Ingestion - POST /cmdb/ingest/{data_source_sys_id}
Inserts records into the Import Set table associated with the data source record identified by the passed-in sys_id.
In addition, this API won't work by default for zbooted instances.
The request body must contain the JSON array of objects (payload) to insert in the Import Set table. Each object equates to a row in the table, each name-value pair equates to a column. The JSON payload must leverage the field names from the import set without the "u_" prefix. For example, the field name "u_matching_record" should be "matching_record" in the request body payload. If the Import Set table exists, the endpoint appends the rows (objects) to the existing Import Set table. No checking for duplicates or updating of existing records is performed.
If you are initially building an application, you must first create the associated data source record in your instance before calling this endpoint. If you are just using this endpoint to add records to an existing Import Set table, you don't need to create the data source record, but you must know its sys_id. The data source record describes the Import Set table in which to insert the specified payload. This table must extend the Import Set Rows [sys_import_set_row] table. Also, the data source must be set to Attachment and the format set to JSON. For more information on data sources, see Data sources.
If the Import Set table defined in the data source record doesn't exist, the endpoint attaches the passed-in payload to the data source record. To create the initial Import Set table, you must manually import the data into the Import Set table. To import the data, on the associated Data Source form, click the Test Load 20 Records or Load All Records link in the Related Links section. Once the Import Set table is created, you can't add columns to the table using this endpoint. If name-value pairs are later passed in that don't exist in the Import Set table, they are ignored without warning. If you need to modify the columns within the Import Set table, you can manually add them to the table. You can also delete or rename the Import Set table, and call the endpoint again using the new payload.
You must have the cmdb_import_api_admin role to access this endpoint.
URL format
Versioned URL: /api/now/{api_version}/cmdb/ingest/{data_source_sys_id}
Default URL: /api/now/cmdb/ingest/{data_source_sys_id}
Supported request 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 |
data_source_sys_id | Sys_id of the data source record. Data type: String |
Name | Description |
---|---|
None |
Name | Description |
---|---|
Array | Free-form array of objects that describe the data to append to the associated Import Set table. Each object in the array defines a row in the Import Sets table; each name-value pair a column. Note: This array must be named, such as
"{\"records\":[{\"hostname\": \"Hostname1\", \"serialnumber\": \"2acd3873-7fc5-454c-8844-e7769e4d6cfc\", \"model\": \"Model Id"},{\"vendor\": \"ABC
Co\"}]}" .Data type: Array of Objects |
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.
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 |
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
Successful response: