netbox
netbox copied to clipboard
Inconsistent API for interface-templates that belongs to a particular device_type
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
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:
Note that all undefined filters are just ignored.
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.
I see (and support) your point. I'd recommend editing the title of the issue to reflect the actual issue at hand.
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.