Inconsistent API for interface-templates that belongs to a particular device_type #9251

Closed
opened 2025-12-29 20:47:29 +01:00 by adam · 4 comments
Owner

Originally created by @rkiss on GitHub (Feb 15, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.2

Python Version

3.8

Steps to Reproduce

Create two "Device Type" objects named type1 and type2 and add an Interface named eth0 to each of them.
Call /api/dcim/interface-templates/?name=eth0&device_type=type1.

Expected Behavior

A single object to be returned, the interface template named eth0 of the first device type

Observed Behavior

Two records returned, looks like the device_type=type1 is ignored. Per filtering rules should match the slug of the device_type

Originally created by @rkiss on GitHub (Feb 15, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.2 ### Python Version 3.8 ### Steps to Reproduce Create two "Device Type" objects named `type1` and `type2` and add an Interface named `eth0` to each of them. Call `/api/dcim/interface-templates/?name=eth0&device_type=type1`. ### Expected Behavior A single object to be returned, the interface template named `eth0` of the first device type ### Observed Behavior Two records returned, looks like the `device_type=type1` is ignored. Per filtering rules should match the slug of the device_type
adam closed this issue 2025-12-29 20:47:29 +01:00
Author
Owner

@markkuleinio commented on GitHub (Feb 15, 2024):

API documentation doesn't list a device_type filter in https://demo.netbox.dev/api/schema/swagger-ui/#/dcim/dcim_interface_templates_list, only devicetype_id:

image

Note that all undefined filters are just ignored.

@markkuleinio commented on GitHub (Feb 15, 2024): API documentation doesn't list a `device_type` filter in https://demo.netbox.dev/api/schema/swagger-ui/#/dcim/dcim_interface_templates_list, only `devicetype_id`: ![image](https://github.com/netbox-community/netbox/assets/25136274/d250632a-40aa-48cc-83bc-3a37c52c8ba6) Note that all undefined filters are just ignored.
Author
Owner

@rkiss commented on GitHub (Feb 15, 2024):

I see.

Still, I think the API is a bit inconsistent here. For example the device have also a device_type but there we do can query either for id or for slug, see: https://netbox-dev.vpu-staging-apps.ti.intel.com/api/schema/swagger-ui/#/dcim/dcim_devices_list

The same approach shall be done everywhere.

@rkiss commented on GitHub (Feb 15, 2024): I see. Still, I think the API is a bit inconsistent here. For example the `device` have also a `device_type` but there we do can query either for id or for slug, see: https://netbox-dev.vpu-staging-apps.ti.intel.com/api/schema/swagger-ui/#/dcim/dcim_devices_list The same approach shall be done everywhere.
Author
Owner

@markkuleinio commented on GitHub (Feb 15, 2024):

I see (and support) your point. I'd recommend editing the title of the issue to reflect the actual issue at hand.

@markkuleinio commented on GitHub (Feb 15, 2024): I see (and support) your point. I'd recommend editing the title of the issue to reflect the actual issue at hand.
Author
Owner

@jeremystretch commented on GitHub (Feb 20, 2024):

Only devicetype_id is supported for component templates, as has been pointed out. If you'd like to propose a new filter be added, please open a detailed feature request citing your use case.

@jeremystretch commented on GitHub (Feb 20, 2024): Only `devicetype_id` is supported for component templates, as has been pointed out. If you'd like to propose a new filter be added, please open a detailed [feature request](https://github.com/netbox-community/netbox/issues/new?assignees=&labels=type%3A+feature&projects=&template=feature_request.yaml) citing your use case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9251