11-16-2021 03:49 AM
Hello all,
I am searching for a way to get the location of all devices from DNA-Center via API.
The only solution I found is to first get a list of device IDs (/intent/api/v1/network-device) and then get the details for every device (/intent/api/v1/device-detail?identifier=uuid&searchBy=...). The response then contains the 'location' key, this is what I need.
The problem is that we have thousands of devices, so thousands of API calls and minutes to hours of waiting. There should be a simpler solution, but I don't see it.
Can anyone give me a hint on how to get the location of every device from DNA-Center in a single (or just a few) API call?
Robin
11-16-2021 05:10 AM
What version of DNAC are you running? I know with 2.2.3.x APIs you can use this API to get location: Get Network Device By IP
/dna/intent/api/v1/network-device/ip-address/{ipAddress}
Example return payload:
{ "response": { "apManagerInterfaceIp": null, "associatedWlcIp": null, "bootDateTime": null, "collectionInterval": null, "collectionStatus": null, "errorCode": null, "errorDescription": null, "family": null, "hostname": null, "id": null, "instanceTenantId": null, "instanceUuid": null, "interfaceCount": null, "inventoryStatusDetail": null, "lastUpdateTime": null, "lastUpdated": null, "lineCardCount": null, "lineCardId": null, "location": null, "locationName": null, "macAddress": null, "managementIpAddress": null, "memorySize": null, "platformId": null, "reachabilityFailureReason": null, "reachabilityStatus": null, "role": null, "roleSource": null, "serialNumber": null, "series": null, "snmpContact": null, "snmpLocation": null, "softwareType": null, "softwareVersion": null, "tagCount": null, "tunnelUdpPort": null, "type": null, "upTime": null, "waasDeviceMode": null }, "version": null }
11-16-2021 11:31 PM
Hello Mike,
I am on version 2.2.3.3 now (was 2.2.2.x until yesterday), but no matter which device I look at, the "location" attribute in /dna/intent/api/v1/network-device/ip-address/{ipAddress} ist always "null", whereas the "location" attribute in /intent/api/v1/device-detail?identifier=uuid&searchBy={id} shows what I want, i.e. the "Global/Area/Building/Floor" string that the device is assigned to.
06-20-2022 12:43 PM
Was an answer ever found for this? Currently looking for a way to grab the location of a device via API. The Get device list call says this field is a map type. Only map info I see is wireless related, I want everything which wouldnt get added to a wireless AP map..
06-21-2022 06:45 AM
It does not look like there is a solution. The official API does not present the location.
06-22-2022 12:56 AM
No, no answer yet.
01-12-2023 09:01 AM
Just to update on what info i have found. Is that the value is correlated to what SNMP location the device has and not the folder in inventory you placed a device. frustrating. that is why 2 calls are needed to get the info i need. as the 'Site' a device is assigned to uses a different call.
07-28-2023 04:35 AM
I would like to get the location information which will have latitude , longitude or x , y coordinates of the location.
Also if I can retrieve floor maps using some API please let me know.
08-24-2023 09:42 AM
I found a way to accomplish pulling the devices per site, and the site has all the location information needed.
First we pull the site, general api call:
sitepull = '/dna/intent/api/v1/site'
Then we parse the list of sites and pull the membership per site
'/dna/intent/api/v1/membership/{}'.format(site['id'])
This returns the site general memberships and the devices associated with the site.
Hope this helps
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