Skip to content

Allow dynamic specification of fields to return in REST API #15087

Closed
@arthanson

Description

@arthanson

NetBox version

v3.7.2

Feature type

Change to existing functionality

Proposed functionality

Allow dynamically specifying which fields to return in REST APIs, something like ?fields=a,b,c or ?exclude=e,f. Similar to GraphQL how you can only return the fields you specifically need. There are several projects that do this - they are at different levels of maintainership so might make sense to just roll our own:

These offer differing levels of functionality:

  • specify which fields to include: ?fields=
  • specify which fields to exclude: ?exclude= we probably don't need this
  • allow specifying field inclusion on FK references via double-underscore reference: ?fields='front_port__name,... we probably don't need this

Use case

This has several advantages:

  • Allow getting rid of brief API
  • more flexible and performant as can only return fields you specifically want
  • Works better / more flexible for the API for dropdown queries where the existing brief APIs don't quite fit

Database changes

None

External dependencies

Potential to use external library, but we may want to just roll our own.

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

Relationships

None yet

Development

No branches or pull requests

Issue actions