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

Closed
opened 2025-12-29 21:43:06 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jun 18, 2025).

Originally assigned to: @jeremystretch on GitHub.

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

Originally created by @jeremystretch on GitHub (Jun 18, 2025). Originally assigned to: @jeremystretch on GitHub. ### 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: ```json { "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
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:43:06 +01:00
adam closed this issue 2025-12-29 21:43:06 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11292