GraphQL: Add device_type as a filter for device_list / device #6588

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

Originally created by @ryanmerolle on GitHub (Jun 22, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.2.5

Feature type

Change to existing functionality

Proposed functionality

Currently, you can only filter device_type_id in the graphql filters. It would be good to filter on either the slug or the name of device_type. It actually looks like this function is missing from the normal rest api also.

Current way to filter on device_type:

{
  device_list(device_type_id: "11") {
    id
    name
    device_type {
      id
    }
  }
}

Requested approach:

{
  device_list(device_type: "<insert slug OR model>") {
    id
    name
    device_type {
      id
    }
  }
}

Use case

Often individuals do not know the id, so its hard to pass said value if you do not know it.

Frankly this just further sets graphql API standardization since this is already supported for device_role (you can filter on it like below):

{
  device_list(role: "patch-panel") {
    id
    name
    device_type {
      id
      model
      slug
    }
    device_role {
      id
      slug
    }
  }
}

Database changes

N/A

External dependencies

N/A

Originally created by @ryanmerolle on GitHub (Jun 22, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.2.5 ### Feature type Change to existing functionality ### Proposed functionality Currently, you can only filter device_type_id in the graphql filters. It would be good to filter on either the slug or the name of device_type. It actually looks like this function is missing from the normal rest api also. Current way to filter on device_type: ``` { device_list(device_type_id: "11") { id name device_type { id } } } ``` Requested approach: ``` { device_list(device_type: "<insert slug OR model>") { id name device_type { id } } } ``` ### Use case Often individuals do not know the id, so its hard to pass said value if you do not know it. Frankly this just further sets graphql API standardization since this is already supported for device_role (you can filter on it like below): ``` { device_list(role: "patch-panel") { id name device_type { id model slug } device_role { id slug } } } ``` ### Database changes N/A ### External dependencies N/A
adam added the status: acceptedtype: feature labels 2025-12-29 19:42:40 +01:00
adam closed this issue 2025-12-29 19:42:40 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 23, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Aug 23, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

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

Blocked by #9856

@jeremystretch commented on GitHub (Aug 25, 2022): Blocked by #9856
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6588