Filtering for "status" not working in GraphQL #6345

Closed
opened 2025-12-29 19:39:40 +01:00 by adam · 2 comments
Owner

Originally created by @v0tti on GitHub (Apr 11, 2022).

NetBox version

v3.1.10

Python version

3.9

Steps to Reproduce

Execute a GraphQL query filtering for a specific status.

For example query the IP Address List or the Device List:

{
  ip_address_list(status: "DHCP") {
    status
  }
  device_list(status: "ACTIVE") {
    status
  }
}

Expected Behavior

I would expect the query to only return IP Addresses with the status "DHCP" and Devices with the status "ACTIVE".

Observed Behavior

IP Addresses and Devices with all statuses are returned. The filter seems to have no effect.

Originally created by @v0tti on GitHub (Apr 11, 2022). ### NetBox version v3.1.10 ### Python version 3.9 ### Steps to Reproduce Execute a GraphQL query filtering for a specific status. For example query the IP Address List or the Device List: ``` { ip_address_list(status: "DHCP") { status } device_list(status: "ACTIVE") { status } } ``` ### Expected Behavior I would expect the query to only return IP Addresses with the status "DHCP" and Devices with the status "ACTIVE". ### Observed Behavior IP Addresses and Devices with all statuses are returned. The filter seems to have no effect.
adam added the type: bug label 2025-12-29 19:39:40 +01:00
adam closed this issue 2025-12-29 19:39:40 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 11, 2022):

GraphQL uses the same filter sets as the UI and REST API; you need to reference the actual value of the field rather than the equivalent GraphQL constant. For example:

{
  device_list(status: "active") {
    status
  }
}
@jeremystretch commented on GitHub (Apr 11, 2022): GraphQL uses the same filter sets as the UI and REST API; you need to reference the actual value of the field rather than the equivalent GraphQL constant. For example: ``` { device_list(status: "active") { status } } ```
Author
Owner

@v0tti commented on GitHub (Apr 11, 2022):

Thank you, it works now. However, it is not very intuitive for me.

@v0tti commented on GitHub (Apr 11, 2022): Thank you, it works now. However, it is not very intuitive for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6345