Description
NetBox version
v4.3.0
Feature type
Change to existing functionality
Proposed functionality
Introduce support for the in_list operator across all GraphQL filters for ID and Enum fields (like status or interface types) in NetBox's v4.3.0, aligning with most other filter options for other fields in the NetBox GraphQL API.
This operator allows filtering objects by specifying multiple values simultaneously using a concise syntax:
query {
circuit_list {
terminations(filter: { site: { id: { in_list: [1, 2] } } }) {
id
site { name }
}
}
}
Use case
This feature significantly simplifies and optimizes common automation tasks and data integrations. Examples include:
Batch Object Retrieval
Quickly query multiple objects by IDs or statuses within one GraphQL request. While GraphQL does offer other logical operators like OR, they don't cleanly fit every use case where filtering by multiple values is needed.
query {
device_list(filter: { status: { in_list: [ACTIVE, PLANNED, STAGED] } }) {
id
name
status
}
}
Dashboard Filtering
Simplify dashboards displaying entities filtered by various criteria, making queries cleaner and easier to maintain.
The REST API currently supports similar functionality, and the v4.3.0 GraphQL API also provides similar capability on most endpoints/field filters. Adding in_list to the current GraphQL filtering mechanism for IDs and Enums continues this existing theme, eliminating the need for chaining multiple "OR" filters - which are difficult to produce dynamically without awkward/cumbersome string manipulation.
The ability to combine in_list, OR filters, and pagination would provide maximum API flexibility; serving diverse use cases.
Database changes
N/A
External dependencies
N/A