- The GET /network-device API is documented as getting a list of devices with a filter including host name. The Swagger API page does not show how to use filters, so it is not clear whether, or how, this should or would work.
- The alternative seems to be to get all network devices, and then to iterate though the results looking for the device with the desired host name. Then one can take the ID of that device and use the APIs that take {id} as an argument.
- Whilst the above approach is mechanically possible, it is not very efficient. All of the devices have to returned, and iterated over, to find the ID of a single device.
- Since this is obviously less than desirable, there must be a better way. Does anyone know what that is please
The pattern is very simple and consistent. All the filters should work the same way (if supported)
/resource?attribute=value
https://{{apic}}:{{port}}/api/v1/network-device?hostname=AHEC-2960C1
Request to filter gives single response, below. But only for attributes that are supported... like hostname
https://{{apic}}:{{port}}/api/v1/network-device?hostname=AHEC-2960C1
{
"response": [
{
"family": "Switches and Hubs",
"location": null,
"type": "Cisco Catalyst 2960C-8PC-L Switch",
"serialNumber": "FOC1637Y3FJ",
"role": "CORE",
"lastUpdated": "2016-07-06 20:40:23",
"lastUpdateTime": 1467837623914,
"series": "Cisco Catalyst 2960-C Series Switches",
"upTime": "1 day, 2:20:31.50",
"softwareVersion": "15.2(2.5.72)E4",
"inventoryStatusDetail": "<status><general code=\"SUCCESS\"/></status>",
"locationName": null,
"tagCount": "2",
"macAddress": "54:78:1a:8e:28:c0",
"hostname": "AHEC-2960C1",
"bootDateTime": "2016-07-05 18:20:11",
"collectionStatus": "Managed",
"interfaceCount": "11",
"lineCardCount": "5",
"lineCardId": "54daa439-db87-426a-83ae-503d5063e521, b636196b-2bd7-4e95-b17d-9ce266c3e421, 61aeed51-06a0-409e-a575-1aab41f30783, 96582c50-15cf-4621-bcdd-6fab62583c59, b70437b5-8470-4086-bcbc-3f1b946a75f6",
"managementIpAddress": "165.10.1.31",
"memorySize": "59556224",
"platformId": "WS-C2960C-8PC-L",
"reachabilityFailureReason": "",
"reachabilityStatus": "Reachable",
"roleSource": "MANUAL",
"snmpContact": "",
"snmpLocation": "",
"tunnelUdpPort": null,
"apManagerInterfaceIp": "",
"instanceUuid": "2dc30cac-072e-4d67-9720-cc302d02695a",
"id": "2dc30cac-072e-4d67-9720-cc302d02695a"
}
],
"version": "1.0"
Comments
0 comments
Please sign in to leave a comment.