cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
897
Views
3
Helpful
2
Replies

How to search devices using API

Bobby Stojceski
Level 1
Level 1

How can devices or items be searched for using the APIC-EM API? In PI I use the contains("search_string") method in the URL but I can't find an equivalent in APIC-EM's API. I tried using "=@" and "*=" and the same as PI in case it was the same function but none work.

So if I wanted to search/filter for any devices that start with the IP address "10.20.30.", how do I do that? Or if I wanted to search for part of a MAC address for example? Or maybe want to search for any network devices that have a hostname starting with "AU".

How is this done using APIC-EM API? Thank you

2 Replies 2

yawming
Cisco Employee
Cisco Employee

For example you you like know the device with certain IP address you can use

GET /network-device/ip-address/{ipAddress} API

This one is easier because there is an existing API, otherwise you can use

GET /network-device


to get all network devices then depends on the key you like to search,

for example "serialNumber": "FGL1548S2YF" or "macAddress": "68:bc:0c:63:4a:b0",or "hostname": "Branch-Router1"

you iterate the entire response from the GET query to find the device ID

for the device then use

GET /network-device/{id}

to get the detail of that device

Maybe there is other way but wonder if this can serve your need ?









Joe Clarke
Cisco Employee
Cisco Employee

You can also filter the results of, say, network-device:

https://apic-em/api/v1/network-device?managementIpAddress=10.20.30.

Properties like hostname, serialNumber and managementIpAddress can be used as query args.  They will then do begins with searches.  You can use '%' as a wildcard character to do contains searches:

https://apic-em/api/v1/network-device?managementIpAddress=%.20.%