cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
718
Views
0
Helpful
3
Replies

Find site / location for AP using DNA API

koldfield
Level 1
Level 1

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:

  • /dna/intent/api/v1/network-device?hostname=...
  • /dna/intent/api/v1/wireless/accesspoint-configuration/summary?key={mac}
  • /api/v1/network-device/wireless/accesspoint/detail/?id={id from network-device above}

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.

1 Accepted Solution

Accepted Solutions

koldfield
Level 1
Level 1

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.

View solution in original post

3 Replies 3

pieterh
VIP
VIP

I'm not experienced with API's, but I suggest  just to look at the inventory  API , not AP configuration

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"
}

 

koldfield
Level 1
Level 1

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.