-
How do I get a list of devices (dcim.device) whose primary IP addresses are in a certain prefix (ipam.prefix) using the REST API? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The available filters on The only query params which relate to primary ip are However...
Yes. To find all the IP addresses within prefix 192.168.1.0/24, you would call Furthermore, you'll find each returned IP address has an Adding |
Beta Was this translation helpful? Give feedback.
The available filters on
/api/dcim/devices/
are in the source code here.The only query params which relate to primary ip are
has_primary_ip
,primary_ip4_id
andprimary_ip6_id
.However...
Yes. To find all the IP addresses within prefix 192.168.1.0/24, you would call
/api/ipam/ip-addresses/?parent=192.168.1.0%2F24
- code reference here.Furthermore, you'll find each returned IP address has an
assigned_object
field, which will tell you the interface and device …