cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1208
Views
5
Helpful
2
Replies

Cisco Prime API Filtering output

p.juarezponte
Level 1
Level 1

Hello team,

I have to get some information from lots of devices.

In this case, I need information such as ip address, device name and serial number.

When I send the request, it takes so long (we have more than 11k devices) because serial number does not appear in "data/Devices.json" 

So, I have to get a "data/InventoryDetails.json" and I am getting so much information that I don't need.

Is there any way to send the request to get only needed fileds?

In this case, should be summary and chassis information.

 

I attach my request.

 

ruta_url = "data/InventoryDetails.json"
args = {
"summary.productFamily": ['"Switches and Hubs", "Unsupported Cisco Device", "Wireless Controller"'],
".full": "true",
".maxResults": 1000
}
r = session.get(url_prime + ruta_url, params=args)

Then, I have to parse all that big output to get needed fields.

May I request just for mentioned fields?

 

2 Replies 2

Spencer Zier
Cisco Employee
Cisco Employee

Unfortunately no.  We investigated adding support for this, as we called it "user-defined projections".  Ultimately, there were too many impacts and issues caused by trying to support this, and only a few cases where there were noticeable improvements in API response time.

 

Aside from our standard recommendations for improving your API throughput, the only thing I could recommend would be putting serial numbers in a data warehouse after you've fetched them once because they won't change (unlike the configured name and management IP).  Then you can rely on GET data/Devices to fetch everything, and only query GET data/InventoryDetails when you need a serial number for a newly managed device.

Ok Spencer, thanks anyway

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: