get all IPs assigned under a prefix with an API call
1,359 views
Skip to first unread message
harshad sowani
unread,
Dec 1, 2021, 4:01:54 PM12/1/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to NetBox
Hi,
I'm trying to get (via the API) a list of all IP addresses that have been
1. defined in netbox and
2. fall under prefixes that have a certain role assigned.
The UI returns a list of all IP address under a particular prefix if i browse to /ipam/prefixes/<prefixid>/ip-addresses/ - is there a way to do this via the API?
Thanks!
Brian Candler
unread,
Dec 1, 2021, 4:16:43 PM12/1/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
The UI returns a list of all IP address under a particular prefix if i browse to /ipam/prefixes/<prefixid>/ip-addresses/ - is there a way to do this via the API?
class IPAddressFilterSet(PrimaryModelFilterSet, TenancyFilterSet):
...
parent = django_filters.CharFilter(
method='search_by_parent',
label='Parent prefix',
)
That is, querying /api/ipam/ip-addresses/?parent=1.2.3.0%2F24 should do it
harshad sowani
unread,
Dec 1, 2021, 4:18:38 PM12/1/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to NetBox
Exactly what I needed - thanks for the super quick response!