routeprotocol.com

Cisco DNA Centre API

Cisco DNA Centre expects all incoming data from the REST API to be in JSON format.

HTTP POST function is used to send the credentials to the DNA Centre Controller.

Cisco DNA Centre uses basic authentication to pass a username and password to the Cisco DNA Centre Token API to authenticate users.

The API is used to authentea user to the Cisco DNA Centre controller to make additional API calls

Setting up an API call in Postman to Log in

Enter in the URL bar:

https://sandboxdnac.cisco.com/api/system/v1/auth/token

Select HTTP Post

Set Authorisation type to Basic in Authorization tab

Enter devnetuser as the username, enter Cisco123! as the password

Select Headers tab and enter Content-Type as new key, application/json as the value

Click Send button

You should receive a token back if authentication was successful. This token is to be used any further calls via the API to prove you have authenticated.

Retrieve a list of network devices

Copy the token retrieved from the last step, just the value, no key or other formatting needing

Enter the URL https://sandboxdnac.cisco.com/api/v1/network-device

Select the option HTTP GET

Enter a new Header called X-Auth-Token and paste in the token as the value

Send the request and content will be returned:

{
    "response": [
        {
            "memorySize": "3735302144",
            "family": "Wireless Controller",
            "role": "ACCESS",
            "description": "Cisco Controller Wireless Version:8.5.140.0",
            "roleSource": "AUTO",
            "lastUpdated": "2021-10-31 13:48:05",
            "deviceSupportLevel": "Supported",
            "softwareType": "Cisco Controller",
            "softwareVersion": "8.5.140.0",
            "macAddress": "ac:4a:56:6c:7c:00",
            "collectionInterval": "Global Default",
            "inventoryStatusDetail": "<status><general code=\"SUCCESS\"/></status>",
            "serialNumber": "FOL25040021",
            "lastUpdateTime": 1635688085542,
            "hostname": "c3504.abc.inc",
            "tagCount": "0",
            "tunnelUdpPort": "16666",
            "uptimeSeconds": 9851327,
            "waasDeviceMode": null,
            "apManagerInterfaceIp": "",
            "bootDateTime": "2021-07-09 13:31:05",
            "collectionStatus": "Managed",
            "locationName": null,
            "managementIpAddress": "10.10.20.51",
            "platformId": "AIR-CT3504-K9",
            "reachabilityFailureReason": "",
            "reachabilityStatus": "Reachable",
            "series": "Cisco 3500 Series Wireless LAN Controller",
            "snmpContact": "",
            "snmpLocation": "",
            "upTime": "114 days, 0:17:21.00",
            "apEthernetMacAddress": null,
            "associatedWlcIp": "",
            "errorCode": null,
            "errorDescription": null,
            "interfaceCount": "0",
            "lineCardCount": "0",
            "lineCardId": "",
            "managedAtleastOnce": true,
            "location": null,
            "type": "Cisco 3504 Wireless LAN Controller",
            "managementState": "Managed",
            "instanceUuid": "6b741b27-f7e7-4470-b6fc-d5168cc59502",
            "instanceTenantId": "5e8e896e4d4add00ca2b6487",
            "id": "6b741b27-f7e7-4470-b6fc-d5168cc59502"
        },
        {
            "memorySize": "NA",
            "family": "Switches and Hubs",
            "role": "ACCESS",
            "description": "Cisco IOS Software [Amsterdam], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 17.3.3, RELEASE SOFTWARE (fc7) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2021 by Cisco Systems, Inc. Compiled Thu 04-Mar-21 12:32 by mcpre",
            "roleSource": "AUTO",
            "lastUpdated": "2021-10-31 13:50:19",
            "deviceSupportLevel": "Supported",
            "softwareType": "IOS-XE",
            "softwareVersion": "17.3.3",
            "macAddress": "84:8a:8d:05:76:00",
            "collectionInterval": "Global Default",
            "inventoryStatusDetail": "<status><general code=\"SUCCESS\"/></status>",
            "serialNumber": "FCW2220G09V",
            "lastUpdateTime": 1635688219044,
            "hostname": "leaf1.abc.inc",
            "tagCount": "0",
            "tunnelUdpPort": null,
            "uptimeSeconds": 244174,
            "waasDeviceMode": null,
            "apManagerInterfaceIp": "",
            "bootDateTime": "2021-10-28 18:10:19",
            "collectionStatus": "Managed",
            "locationName": null,
            "managementIpAddress": "10.10.20.81",
            "platformId": "C9300-24U",
            "reachabilityFailureReason": "",
            "reachabilityStatus": "Reachable",
            "series": "Cisco Catalyst 9300 Series Switches",
            "snmpContact": "",
            "snmpLocation": "",
            "upTime": "2 days, 19:40:48.51",
            "apEthernetMacAddress": null,
            "associatedWlcIp": "",
            "errorCode": null,
            "errorDescription": null,
            "interfaceCount": "0",
            "lineCardCount": "0",
            "lineCardId": "",
            "managedAtleastOnce": true,
            "location": null,
            "type": "Cisco Catalyst 9300 Switch",
            "managementState": "Managed",
            "instanceUuid": "aa0a5258-3e6f-422f-9c4e-9c196db115ae",
            "instanceTenantId": "5e8e896e4d4add00ca2b6487",
            "id": "aa0a5258-3e6f-422f-9c4e-9c196db115ae"
        },
        {
            "memorySize": "NA",
            "family": "Switches and Hubs",
            "role": "DISTRIBUTION",
            "description": "Cisco IOS Software [Gibraltar], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.11.1c, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2019 by Cisco Systems, Inc. Compiled Tue 18-Jun-19 21:21 by mcpre",
            "roleSource": "AUTO",
            "lastUpdated": "2021-10-31 13:51:53",
            "deviceSupportLevel": "Supported",
            "softwareType": "IOS-XE",
            "softwareVersion": "16.11.1c",
            "macAddress": "68:ca:e4:37:8d:80",
            "collectionInterval": "Global Default",
            "inventoryStatusDetail": "<status><general code=\"SUCCESS\"/></status>",
            "serialNumber": "FCW2211G0MA",
            "lastUpdateTime": 1635688313439,
            "hostname": "leaf2.abc.inc",
            "tagCount": "0",
            "tunnelUdpPort": null,
            "uptimeSeconds": 44039,
            "waasDeviceMode": null,
            "apManagerInterfaceIp": "",
            "bootDateTime": "2021-10-31 01:45:53",
            "collectionStatus": "Managed",
            "locationName": null,
            "managementIpAddress": "10.10.20.82",
            "platformId": "C9300-24U",
            "reachabilityFailureReason": "",
            "reachabilityStatus": "Reachable",
            "series": "Cisco Catalyst 9300 Series Switches",
            "snmpContact": "",
            "snmpLocation": "",
            "upTime": "12:06:01.90",
            "apEthernetMacAddress": null,
            "associatedWlcIp": "",
            "errorCode": null,
            "errorDescription": null,
            "interfaceCount": "0",
            "lineCardCount": "0",
            "lineCardId": "",
            "managedAtleastOnce": true,
            "location": null,
            "type": "Cisco Catalyst 9300 Switch",
            "managementState": "Managed",
            "instanceUuid": "f0cb8464-1ce7-4afe-9c0d-a4b0cc5ee84c",
            "instanceTenantId": "5e8e896e4d4add00ca2b6487",
            "id": "f0cb8464-1ce7-4afe-9c0d-a4b0cc5ee84c"
        },
        {
            "memorySize": "NA",
            "family": "Switches and Hubs",
            "role": "ACCESS",
            "description": "Cisco IOS Software [Gibraltar], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.11.1c, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2019 by Cisco Systems, Inc. Compiled Tue 18-Jun-19 21:21 by mcpre",
            "roleSource": "AUTO",
            "lastUpdated": "2021-10-31 13:48:07",
            "deviceSupportLevel": "Supported",
            "softwareType": "IOS-XE",
            "softwareVersion": "16.11.1c",
            "macAddress": "70:1f:53:73:8d:00",
            "collectionInterval": "Global Default",
            "inventoryStatusDetail": "<status><general code=\"SUCCESS\"/></status>",
            "serialNumber": "FOC2135Z00T",
            "lastUpdateTime": 1635688087922,
            "hostname": "spine1.abc.inc",
            "tagCount": "0",
            "tunnelUdpPort": null,
            "uptimeSeconds": 43545,
            "waasDeviceMode": null,
            "apManagerInterfaceIp": "",
            "bootDateTime": "2021-10-31 01:54:07",
            "collectionStatus": "Managed",
            "locationName": null,
            "managementIpAddress": "10.10.20.80",
            "platformId": "C9300-48U",
            "reachabilityFailureReason": "",
            "reachabilityStatus": "Reachable",
            "series": "Cisco Catalyst 9300 Series Switches",
            "snmpContact": "",
            "snmpLocation": "",
            "upTime": "11:54:16.45",
            "apEthernetMacAddress": null,
            "associatedWlcIp": "",
            "errorCode": null,
            "errorDescription": null,
            "interfaceCount": "0",
            "lineCardCount": "0",
            "lineCardId": "",
            "managedAtleastOnce": true,
            "location": null,
            "type": "Cisco Catalyst 9300 Switch",
            "managementState": "Managed",
            "instanceUuid": "f16955ae-c349-47e9-8e8f-9b62104ab604",
            "instanceTenantId": "5e8e896e4d4add00ca2b6487",
            "id": "f16955ae-c349-47e9-8e8f-9b62104ab604"
        }
    ],
    "version": "1.0"
}

The URL can be modified to show only 1 device with ?limit=1

An offset can be entered too, to only show the second device add ?offset=2 or &offset=2 at the end of the URL


by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.