Skip to content

Add REST API filtering support for dcim.devices Serial field #9705

@decoupca

Description

@decoupca

NetBox version

v3.1.2

Feature type

Change to existing functionality

Proposed functionality

According to the docs, string fields can be filtered with expressions. However, the serial number field is not, in fact, filterable using any provided expression (except exact match). I propose to include serial number in the list of available fields to filter using expressions. If this FR is not approved, I propose clarifying this exception in the docs.

Use case

I wanted to share a link with my colleagues to a list of all devices that lack a serial number value. Based on the docs, this should be possible by appending ?serial__empty=true to the query string. This is much easier than either exporting a static CSV and filtering it, or going to the trouble of writing a report.

It also may be useful to search for serial numbers beginning or ending with a certain string to identify devices affected by the same OEM issue.

Moreover, since the API filtering logic is already implemented for other fields, it seems sensible and feasible to enable that for serial numbers as well.

Database changes

None, as far as I can tell

External dependencies

None

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions