API: Filtering ip-address by interface_id raises bad request #4127

Closed
opened 2025-12-29 18:33:19 +01:00 by adam · 4 comments
Owner

Originally created by @hensoko on GitHub (Sep 22, 2020).

Environment

  • Python version: 3.7.3
  • NetBox version: 2.9.3

Steps to Reproduce

  1. Create a device and add an interface on it
  2. Assign ip-address to interface
  3. curl -XGET -I -H "Authorization: Token ..." https://<netbox>/api/ipam/ip-addresses/?interface_id=<id of interface> or open in browser

Expected Behavior

HTTP Status 200 and a list of all ip-addresses that are assigned to the given interface

Observed Behavior

HTTP 400 Bad Request
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "interface_id": [
        "Select a valid choice. 1 is not one of the available choices."
    ]
}
Originally created by @hensoko on GitHub (Sep 22, 2020). ### Environment * Python version: 3.7.3 * NetBox version: 2.9.3 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Create a device and add an interface on it 2. Assign ip-address to interface 3. `curl -XGET -I -H "Authorization: Token ..." https://<netbox>/api/ipam/ip-addresses/?interface_id=<id of interface>` or open in browser <!-- What did you expect to happen? --> ### Expected Behavior HTTP Status 200 and a list of all ip-addresses that are assigned to the given interface <!-- What happened instead? --> ### Observed Behavior ``` HTTP 400 Bad Request Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json Vary: Accept { "interface_id": [ "Select a valid choice. 1 is not one of the available choices." ] } ```
adam closed this issue 2025-12-29 18:33:19 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 22, 2020):

This is the expected behavior. An interface with ID 1 does not exist, hence the error message.

@jeremystretch commented on GitHub (Sep 22, 2020): This is the expected behavior. An interface with ID 1 does not exist, hence the error message.
Author
Owner

@hensoko commented on GitHub (Sep 22, 2020):

My steps were imprecise. Instead of creating a host you have to create a virtual machine. Since I have figured now that vm interface ids and device interface ids are decoupled I wonder how to filter for assigned_object_id and assigned_object_type, my quick tests show that theses attributes are just ignored.

@hensoko commented on GitHub (Sep 22, 2020): My steps were imprecise. Instead of creating a host you have to create a virtual machine. Since I have figured now that vm interface ids and device interface ids are decoupled I wonder how to filter for assigned_object_id and assigned_object_type, my quick tests show that theses attributes are just ignored.
Author
Owner

@jeremystretch commented on GitHub (Sep 22, 2020):

Closing this out as it's not a valid bug report.

I wonder how to filter for assigned_object_id and assigned_object_type, my quick tests show that theses attributes are just ignored.

Please post to the mailing list for general assistance using the REST API.

@jeremystretch commented on GitHub (Sep 22, 2020): Closing this out as it's not a valid bug report. > I wonder how to filter for assigned_object_id and assigned_object_type, my quick tests show that theses attributes are just ignored. Please post to the mailing list for general assistance using the REST API.
Author
Owner

@hensoko commented on GitHub (Sep 23, 2020):

Well it seems no longer possible to filter ip-addresses, assigned to vms, by interface id. At least this is a regression to Netbox 2.8.x. Filtering by assigned_object_id / assigned_object_type is not possible as these parameters are just ignored.

Should I open another issue for that or am I obviously wrong here and you can maybe point me to some kind of documentation?

@hensoko commented on GitHub (Sep 23, 2020): Well it seems no longer possible to filter ip-addresses, assigned to vms, by interface id. At least this is a regression to Netbox 2.8.x. Filtering by assigned_object_id / assigned_object_type is not possible as these parameters are just ignored. Should I open another issue for that or am I obviously wrong here and you can maybe point me to some kind of documentation?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4127