03-19-2025 11:56 PM
I am using Cisco DNA Center APIs to extract an inventory of network devices. The /dna/intent/api/v1/network-device API provides most of the required details, but the location field is missing in the response.
To work around this, I am making an additional API call to /dna/intent/api/v1/device-detail for each device using its UUID to fetch the exact location data. However, this approach significantly increases execution time, making the inventory extraction process take approximately 45 minutes.
Is there a more efficient way to retrieve the device location without making an API call for each individual UUID?
DNAC Version 2.3.5.5-70026-HF60
03-21-2025 08:07 AM
I have been looking into this and thinking about it. I don't have a great or even a good answer so far. In the /dna/intent/api/v1/network-device API call there is a response for "locationName" but I've run this against 2.3.7.7 and for every device it is "null".
My only thought, so far, would be to pull a device list and then in one go loop through it a pull a list based upon all the IDs at one time. Then go back and cross reference it. Not sure if that will speed things up for you or not. I've used the same API you are using to get the UUID for a device but not the other way around. So far I can't find an API call that would get and return the locationName in one shot. I'll keep searching as time permits and see if I come up with something.
03-21-2025 09:58 AM
I dont know if this a bug, which remains unfixed, but going back i recall this locationName being null on the network-device call for a while now. I think this was teh case i once found https://bst.cisco.com/quickview/bug/CSCwb70990
The '/dna/intent/api/v1/site' followed by parsing the list of sites and pull the membership per site'/dna/intent/api/v1/membership/{}'.format(site['id']) - should returns the site general memberships and the devices associated with the site.
In past threads raised it was mentioned to use "Get Device Detail", it should provide the location and hopefully does not return null.
03-21-2025 10:32 AM
A thought here might be to use the /dna/intent/api/v1/network-device/{startIndex}/{recordsToReturn} (https://developer.cisco.com/docs/dna-center/2-3-5/get-network-device-by-pagination-range/). It says it includes the location, location name, hostname, etc in the return. Looks like you could grab up to 500 records at a time. Then cross reference based upon hostname or some other common value. Just a thought while looking through some of the different API calls that are available.
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