Skip to content

Extend the object types REST API endpoint to provide additional details #19722

@jeremystretch

Description

@jeremystretch

NetBox version

v4.3.2

Feature type

Change to existing functionality

Proposed functionality

NetBox currently provides a REST API endpoint at /api/extras/object-types/ which lists all registered object types, both within NetBox core as well as from installed plugins. Currently, this provides minimal information about each object type. For instance:

{
    "id": 57,
    "url": "http://netbox:8000/api/extras/object-types/57/",
    "display": "DCIM | site",
    "app_label": "dcim",
    "model": "site"
}

We can improve the functional value of this endpoint in several ways:

  • Alter the display text to something more human-readable, e.g. "Site" rather than "DCIM | site".
  • Provide the proper app name as a discrete field in addition to its raw label (e.g. "DCIM" vs. "dcim").
  • Provide both the singular and plural forms of each model's verbose name.
  • Include a boolean flag indicating whether the model is provided by a plugin.
  • Include the REST API endpoint for the model (where applicable).

We should also consider moving the endpoint from extras to core, however that might justify a separate FR.

Use case

This seizes an opportunity to deliver additional valuable context concerning the object types supported by NetBox with minimal overhead, and no changes to the data model itself. This information is useful e.g. for discovery by third party clients.

Database changes

None

External dependencies

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: lowRequires minimal effort to implementstatus: backlogAwaiting selection for worktype: featureIntroduction of new functionality to the application

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions