Filter by device does not work when querying for modules via API #6814

Closed
opened 2025-12-29 19:45:43 +01:00 by adam · 1 comment
Owner

Originally created by @agreusel on GitHub (Aug 16, 2022).

NetBox version

v3.2.7

Python version

3.10

Steps to Reproduce

  1. Create module-type (module_a)

  2. Create device type with module bay (device_type_a)

  3. Create multiple devices using device_type_a (device_a, device_b)

  4. Add modules to the module bays of each device created (device_a + module_a, device_b + module_b)

  5. Confirm modules exist via GUI and API and have a device associated with them

  6. Query the API with a filter for "device=device_a"
    https://mynetboxinstance.com/api/dcim/modules/?device=device_a

  7. Receive results for all modules in inventory, not just the one assigned to device_a (module_a & module_b)

Expected Behavior

API query should only return module_a (associated with device_a)

Observed Behavior

All modules in the database are returned (module_a & module_b)

Originally created by @agreusel on GitHub (Aug 16, 2022). ### NetBox version v3.2.7 ### Python version 3.10 ### Steps to Reproduce 1. Create module-type (module_a) 2. Create device type with module bay (device_type_a) 3. Create multiple devices using device_type_a (device_a, device_b) 4. Add modules to the module bays of each device created (device_a + module_a, device_b + module_b) 5. Confirm modules exist via GUI and API and have a device associated with them 6. Query the API with a filter for "device=device_a" https://mynetboxinstance.com/api/dcim/modules/?device=device_a 7. Receive results for all modules in inventory, not just the one assigned to device_a (module_a & module_b) ### Expected Behavior API query should only return module_a (associated with device_a) ### Observed Behavior All modules in the database are returned (module_a & module_b)
adam closed this issue 2025-12-29 19:45:43 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 16, 2022):

There is no device filter for modules. You can use the device_id filter to search for modules installed within a particular device.

@jeremystretch commented on GitHub (Aug 16, 2022): There is no `device` filter for modules. You can use the `device_id` filter to search for modules installed within a particular device.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6814