cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
614
Views
0
Helpful
6
Replies

Device-detail for all device uuids

prasad salvi
Level 1
Level 1

How to get /dna/intent/api/v1/device-detail for all device uuids in my network?
I'm using Python scripts to get the output.

Right now I'm using API:- /intent/api/v1/network-device and for each device uuids I'm using /dna/intent/api/v1/device-detail

so is there any other way as I'm unable to get the site location in the list which is being pulled from /intent/api/v1/network-device

6 Replies 6

Torbjørn
Spotlight
Spotlight

What are you trying to achieve?

location and locationName seems to be deprecated in the response schema from recent Catalyst Center versions. If you are looking for devices at a specific location you should be able to filter for this specifically by appending ?locationName=yourLocation to your query.

If you are looking to fetch locations for all devices there doesn't seem to be any good way to do this except fetching all UUIDs with network-device and getting the device details for each device with device-detail as you've described.

Happy to help! Please mark as helpful/solution if applicable.
Get in touch: https://torbjorn.dev

prasad salvi
Level 1
Level 1

My task is to extract device details but in DNAC API:- /intent/api/v1/network-device
the site hierarchy is missing for example in my scenario Global/Region/Country/Site Name/Buildings/Floors
so need complete data in Excel along with this missing data in my excel sheet

estetson
Cisco Employee
Cisco Employee

Which details are you looking for in your output?  From the inventory, you can use the "Export" option to export an excel of device details in your inventory.  This includes site information

estetson_0-1715266120885.png

If there's other, more specific information you're looking for, you could combine API's.

You can use GET /intent/api/v1/network-device to get a list of all network devices in your inventory. One of the values in this response is the management ip address.  You can feed the management ip address into the following API:
GET /dna/intent/api/v1/business/sda/provision-device 

This response contains the Site Hierarchy (there may be other API's that contains this field too, this is just an example)

estetson_1-1715266707014.png

Note that although the API is titled "Get Provisioned Wired Device", it works (at least in my lab) on wireless devices too.  Hopefully this helps give some ideas.

prasad salvi
Level 1
Level 1

I don't want to use export option

As while exporting I need to export the data twice 1 for APs and 2 for rest of the device types

So I want to use APIs which contains information as belowT

Tags,device name, ip add,device family,site(hierarchy),mac,device role,image version,serial number, platform

 

Out of these all the data is extracted from "intent/api/v1/network-device" API except site(hierarchy)

For getting only site hierarchy related details i need to run the script for each uuid which becomes very time consuming task..as automation is intended to be a time saving task

You wouldn't run the script separately for each UUID. Your script would do both. First, your script pulls all of the UUID's and saves them to a variable. Then, your script (the same script) runs a second API for device-detail against each of the saved UUID's and prints the info you're looking for.

You should be able to run both API's in a single script, you don't need to run a single script against multiple UUID's

Yes, I am running both tasks in a single script. The script first pulls all the UUIDs and saves them to a variable, then runs a second API call for device detail against each of the saved UUIDs. However, I’ve noticed that this approach becomes quite time-consuming when working with a large number of devices.

Since automation is supposed to be a time-saving tool, I'm looking for a more efficient way to handle this process.

Review Cisco Networking for a $25 gift card