06-28-2023 10:17 PM
How do I use the Cisco DNA Centre API to find the site / location for a specific AP?
I have tried the following API end points, but they don't return the AP site / location:
If I know the location I can get a list of APs in it using /dna/intent/api/v1/site?name=.*location-name.*
Using my browser developer tools to snoop on the DNAC GUI I can see that it uses /dna/intent/api/v1/graphql to retrieve the site / location. Whenever I try to use graphql from my script it always returns no results - {'response': []}. This may be because I don't know what to use for the X-CSRF-TOKEN cookie.
Solved! Go to Solution.
07-30-2023 04:11 PM
I've worked out how to get the location details for an AP - use the "device-detail" API call Specifically /dna/intent/api/v1/device-detail.
I've been told that "we are working on adding that [location] back to network device" - so maybe in a future version of DNA the location field will be populated in the network-device API call.
06-30-2023 03:52 AM
I'm not experienced with API's, but I suggest just to look at the inventory API , not AP configuration
06-30-2023 07:19 AM
Looking at the DNA documentation I can't see any inventory specific API calls.
Do you mean /dna/intent/api/v1/network-device? While I would expect it to return the DNA site / location, I can't see it in the response. Here is a typical response:
GET https://my-dna-server/dna/intent/api/v1/network-device?hostname=test-ap
{"response":[{
"lastUpdateTime":1688131256965,
"macAddress":"74:11:b2:a2:32:90",
"deviceSupportLevel":"Supported",
"softwareType":null,
"softwareVersion":"17.9.2.52",
"serialNumber":"FGL2741L12N",
"inventoryStatusDetail":"NA",
"collectionInterval":"NA",
"managementState":"Managed",
"upTime":"16 days, 06:50:31.760",
"roleSource":"AUTO",
"bootDateTime":null,
"series":"Cisco Catalyst 9136I Series Unified Access Points",
"snmpContact":"",
"snmpLocation":"default location",
"apManagerInterfaceIp":"10.1.1.2",
"collectionStatus":"Managed",
"family":"Unified AP",
"hostname":"test-ap",
"locationName":null,
"managementIpAddress":"10.2.1.4",
"platformId":"C9136I-Z",
"reachabilityFailureReason":"NA",
"reachabilityStatus":"Reachable",
"lastUpdated":"2023-06-30 13:20:56",
"associatedWlcIp":"10.1.1.2",
"apEthernetMacAddress":"74:11:b2:bb:4a:c1",
"errorCode":"null",
"errorDescription":null,
"interfaceCount":"0",
"lineCardCount":"0",
"lineCardId":"",
"managedAtleastOnce":false,
"memorySize":"NA",
"tagCount":"0",
"tunnelUdpPort":null,
"uptimeSeconds":1407625,
"waasDeviceMode":null,
"location":null,
"type":"Cisco Catalyst 9136I Unified Access Point",
"description":null,
"role":"ACCESS",
"instanceUuid":"5ab580b8-b449-447d-b096-77bb27cf1a67",
"instanceTenantId":"5b4efebdfca8c1008b38de11",
"id":"5ab580b8-b449-447d-b096-77bb27cf1a67"}],
"version":"1.0"
}
07-30-2023 04:11 PM
I've worked out how to get the location details for an AP - use the "device-detail" API call Specifically /dna/intent/api/v1/device-detail.
I've been told that "we are working on adding that [location] back to network device" - so maybe in a future version of DNA the location field will be populated in the network-device API call.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide