05-07-2024 01:30 AM
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
05-07-2024 01:41 AM - edited 05-07-2024 01:44 AM
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.
05-07-2024 05:13 AM - edited 05-07-2024 05:33 AM
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
05-09-2024 07:59 AM
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
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)
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.
10-13-2024 06:31 PM
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
10-14-2024 06:39 AM
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
10-14-2024 06:53 AM
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.
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