Search Prefixes by an exact description via REST API #6068

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

Originally created by @djothi on GitHub (Feb 9, 2022).

Originally assigned to: @djothi on GitHub.

NetBox version

v3.1.7

Feature type

New functionality

Proposed functionality

curl https://demo.netbox.dev/api/prefixes/?q=CONTAINERS returns all prefixes that have the string "CONTAINERS" in their description. Queryset: Prefix.objects.filter(description__icontains=CONTAINERS)

The proposed functionality is to be able to return all prefixes via the REST API that have an exact description:

curl https://demo.netbox.dev/api/prefixes/?description=CONTAINERS would return only prefixes that have "CONTAINERS" as a description. Queryset: Prefix.objects.filter(description="CONTAINERS")

Use case

Getting Prefixes using an exact description via REST API.

Database changes

None

External dependencies

None

Originally created by @djothi on GitHub (Feb 9, 2022). Originally assigned to: @djothi on GitHub. ### NetBox version v3.1.7 ### Feature type New functionality ### Proposed functionality `curl https://demo.netbox.dev/api/prefixes/?q=CONTAINERS` returns all prefixes that have the string "CONTAINERS" in their description. Queryset: `Prefix.objects.filter(description__icontains=CONTAINERS)` The proposed functionality is to be able to return all prefixes via the REST API that have an exact `description`: `curl https://demo.netbox.dev/api/prefixes/?description=CONTAINERS` would return only prefixes that have "CONTAINERS" as a description. Queryset: `Prefix.objects.filter(description="CONTAINERS")` ### Use case Getting Prefixes using an exact description via REST API. ### Database changes None ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 19:36:18 +01:00
adam closed this issue 2025-12-29 19:36:18 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 18, 2022):

I think it's reasonable to enable this; it should involve just adding 'description' to Meta.fields in the FilterSet. However, if we're going to implement it, it should be added for all models with a description field and not just Prefix.

@jeremystretch commented on GitHub (Feb 18, 2022): I think it's reasonable to enable this; it should involve just adding `'description'` to `Meta.fields` in the FilterSet. However, if we're going to implement it, it should be added for _all_ models with a description field and not just Prefix.
Author
Owner

@djothi commented on GitHub (Feb 24, 2022):

Ok, working on it.

@djothi commented on GitHub (Feb 24, 2022): Ok, working on it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6068