API filter for primary IP

384 views
Skip to first unread message

Heinz Meier

unread,
Dec 18, 2021, 11:01:55 AM12/18/21
to NetBox
Hi,

I want to send a request to the netbox API and find one device with a specific IP address.


fails and returns a list of all devices. Ideas?

Michael

Brian Candler

unread,
Dec 18, 2021, 11:53:25 AM12/18/21
to NetBox
Hmm, I thought of https://127.0.0.1/api/dcim/devices/?primary_ip4=192.2.0.16 but that doesn't work either.

The available filters are in class DeviceFilterSet. I think a primary_ip(|4|6) filter here is a reasonable thing to want.

(It would also be nice if unrecognized query parameters gave a 400 error, but I expect that's a limitation of an underlying library)

Heinz Meier

unread,
Dec 18, 2021, 12:35:00 PM12/18/21
to Brian Candler, NetBox
Hi,

it seems that these filter primary_ip(|46) just do not exist. That would be bad for my task.

Michael

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/07a4ccbe-1439-4e5a-94e3-f64e7f76ee13n%40googlegroups.com.

Brian Candler

unread,
Dec 18, 2021, 12:52:26 PM12/18/21
to NetBox
You can create a Feature Request on github.

I think it should also be straightforward to make a code contribution for - but pull requests must be linked to feature requests anyway.

Reply all
Reply to author
Forward
0 new messages