Collections
The Collections API enable users to automate the process of providing network inventory data to Cisco.
Features
The Collections API provides the following features:
- Supports a RESTful interface, using a RAML definition file.
- Supports JSON data format.
- Supports CSV file import.
- Includes web services that:
- Enable importing network inventory data
- Return current status of imported inventory data
Import Inventory
Import API enables users to automate importing network inventory data to Cisco. The API will transport a JSON formatted inventory as payload to the portal for processing. The Import Inventory Status provides the mechanism to check the status of the ingestion process. Inventory import limit per call is 15,000.
Note: If you are importing chassis and their modules, the chassis should be the first entry with the modules listed after the chassis.
URL
POST : https://apix.cisco.com/cs/api/v1/collections/import-inventory
Request Parameters
Parameter | Type | Max Length | Required | Description |
---|---|---|---|---|
customerId | NUMBER | 12 | Required | Unique identifier of a Cisco customer. |
inventoryName | STRING | 25 | Required | Name of the inventory. |
Data Params
Parameter | Type | Max Length | Required |
---|---|---|---|
hostname | STRING | 255 | Required |
ipAddress | STRING | 64 | Required |
serialNumber | STRING | 50 | Required |
productId | STRING | 255 | Required |
macAddress | STRING | 50 | Optional |
sysLocation | STRING | 255 | Optional |
swType | STRING | 50 | Optional |
swVersion | STRING | 50 | Optional |
Payload:
[
{
"hostname":"767-Villa-test_01",
"ipAddress":"167.123.0.0",
"serialNumber":"12xyz23",
"productId":"AIR-CAP3702I-E-K9C",
"macAddress":"00:00:00:00:00:00",
"sysLocation":"NA",
"swType":"IOS",
"swVersion":"15.3(20161125:123854)"
},
{
"hostname":"767-Villa-test_02",
"ipAddress":"168.123.0.0",
"serialNumber":"12xyz33",
"productId":"AIR-CAP3702I-E-K9C",
"macAddress":"00:00:00:00:00:00",
"sysLocation":"NA",
"swType":"IOS",
"swVersion":"15.3(20161125:123854)"
}
]
Sample Request
https://apix.cisco.com/cs/api/v1/collections/import-inventory?customerId=1234&inventoryName=STAGE16
Sample JSON Response
{
"status": 200,
"message": "Inventory successfully uploaded for processing"
}
Import Inventory File
The Import Inventory File API enables applications to automate importing network inventory data into the Cisco SNTC system. The API transports a comma-separated value (CSV) inventory file as payload to the portal for processing, via the HTTP multipart/form-data
media type (RFC 2388). The Import Inventory Status API provides a mechanism to check the progress of the ingestion process.
NOTE: If you are importing chassis and their modules, the chassis should be the first entry with the modules listed after the chassis.
CSV Sample showing Chassis listed first and modules for that chassis listed after it.
hostname | ipAddress | serialNumber | productId | macAddress | sysLocation | swType | swVersion |
---|---|---|---|---|---|---|---|
2800-router | 172.20.70.20 | FTX10###A3DC | CISCO2851 | iOS | 12.4(15)T9 | ||
2800-router | 172.20.70.20 | FOC10###V4W | PVDM2-16 | iOS | 12.4(15)T9 | ||
2800-router | 172.20.70.20 | ####4001 | VWIC-2MFT-T1 | iOS | 12.4(15)T9 | ||
2800-router | 172.20.70.20 | FOC###3VW5 | NM-HD-2VE | iOS | 12.4(15)T9 | ||
2800-router | 172.20.70.20 | 353####906 | VWIC-2MFT-T1 | iOS | 12.4(15)T9 | ||
2800-router | 172.20.70.20 | FOC####V0S | VIC-4FXS/DID | iOS | 12.4(15)T9 | ||
2800-router | 172.20.70.20 | FOC####3V69 | PVDM2-16 | iOS | 12.4(15)T9 |
URL
POST : https://apix.cisco.com/cs/api/v1/collections/import-inventory-file
Request Parameters
Parameter | Type | Max Length | Required | Description |
---|---|---|---|---|
customerId | NUMBER | 12 | Required | Unique identifier of a Cisco customer. |
inventoryName | STRING | 25 | Required | Name of the inventory. |
Request header
Content-Type: multipart/form-data
Request body
Content-Disposition fields:
- name:
bin
- filename: (name of file being uploaded)
Sample request
POST /cs/api/v1/collections/import-inventory-file?customerId=234523&inventoryName=testFileInventory HTTP/1.1
Authorization: Bearer X6Xsdredactedf1ALHK
Host: apix.cisco.com
Content-Type: multipart/form-data; boundary=--------------------------841777022995229526102130
Content-Length: 532
----------------------------841777022995229526102130
Content-Disposition: form-data; name="bin"; filename="testFileInventory.csv"
<testFileInventory.csv>
----------------------------841777022995229526102130--
Sample JSON Response
{
"status": 200,
"message": "Inventory successfully uploaded for processing"
}
CSV data file format
Parameter | Type | Max Length | Required |
---|---|---|---|
hostname | STRING | 255 | Required |
ipAddress | STRING | 64 | Required |
serialNumber | STRING | 50 | Required |
productId | STRING | 255 | Required |
macAddress | STRING | 50 | Optional |
sysLocation | STRING | 255 | Optional |
swType | STRING | 50 | Optional |
swVersion | STRING | 50 | Optional |
Sample CSV file contents
hostname,ipAddress,serialNumber,productId,macAddress,sysLocation,swType,swVersion
TSPM-SJ-SNTC-AP2,172.21.34.37,FTX1510T06A,AIR-AP1131G-A-K9,,SJCI-1 Lab-4338 Isle-B5 Rack-121,IOS,12.4(21a)JA1
TSPM-SJ-P1C2R1,172.21.34.61,SNI1446C8YM,PWR-3900-AC,,SJCI-1 Lab-4338 Isle-B5 Rack-121,IOS,15.1(1)T2
Import Inventory Status
The Import Inventory Status API returns the current state of inventory data being processed by the portal, be it uploaded by Import Inventory API or through the portal's file upload feature.
URL
GET : https://apix.cisco.com/cs/api/v1/collections/import-inventory-status
Request Parameters
Parameter | Type | Max Length | Required | Description |
---|---|---|---|---|
customerId | NUMBER | 12 | Required | Unique identifier of a Cisco customer. |
inventoryName | STRING | 25 | Optional | Name of the inventory. |
page | NUMBER | Optional | Page number of the response. | |
rows | NUMBER | Optional | Number of rows of data per page. | |
sort | STRING | Optional | Supported sort criteria are either ‘asc’ for ascending or ‘desc’ for descending. |
Response Parameters
Parameter | Type | Max Length | Description |
---|---|---|---|
collectionName | string | 255 | Name of the collection. |
inventorySource | string | 255 | Source of the inventory. |
collectorType | string | 255 | Type of collector. |
uploadReceived | datetime | Inventory upload receive in GMT date format: YYYY-MM-DD"T"HH24:MI:SS. Time is displayed in 24 hour format. | |
processingStart | datetime | Inventory processing start in GMT date format: YYYY-MM-DD"T"HH24:MI:SS. Time is displayed in 24 hour format. | |
processingEnd | datetime | Inventory processing end in GMT date format: YYYY-MM-DD"T"HH24:MI:SS. Time is displayed in 24 hour format. | |
status | string | 255 | Status of the import. For example, RECEIVED, PROCESSING, SUCCESS and FAILED. |
inventoryName | string | 25 | Name of the Inventory. |
Sample Request
https://apix.cisco.com/cs/api/v1/collections/import-inventory-status?customerId=1234
Sample JSON Response
{
"data": [
{
"collectionName": "transport_20180723T090544507-test_Imported_CSV",
"inventorySource": "Services API",
"collectorType": "CSV",
"uploadReceived": "2018-07-23T16:05:44",
"processingStart": "2018-07-23T16:06:00",
"processingEnd": "2018-07-23T16:08:54",
"status": "SUCCESS",
"inventoryName": "SERVICES_API_INV_test_01"
},
{
"collectionName": "transport_20180723T090927933-test_Imported_CSV",
"inventorySource": "Services API",
"collectorType": "CSV",
"uploadReceived": "2018-07-23T16:09:27",
"processingStart": "2018-07-23T16:09:30",
"processingEnd": "2018-07-23T16:11:51",
"status": "RECEIVED",
"inventoryName": "SERVICES_API_INV_test_02"
}
],
"pagination": {
"page": 1,
"pages": 4,
"rows": 2,
"total": 7
}
}