Skip to content

Improve API object_types Labels for Custom Object Types #290

@lukassavukaitis

Description

@lukassavukaitis

Plugin Version

0.4.0

Proposed functionality

Context

  • A custom object type named "dhcpoption" was created (with display name DHCP Option).

When using Custom Object Types, the UI representation under Admin → Permissions is clean and user-friendly (e.g., Custom Objects > DHCP Option).
However, the API output for the same permission displays the underlying Django model name, which is cryptic and not meaningful for end users.

Example from API:

{
    "id": 73,
    "display": "CustomObject-DHCPOption admin",
    "name": "CustomObject-DHCPOption admin",
    "description": "CustomObject-DHCPOption admin permissions",
    "enabled": true,
    "object_types": [
        "netbox_custom_objects.table1model"
    ],
    "actions": [
        "add",
        "delete",
        "change",
        "view"
    ]
}

The value shown in object_types — netbox_custom_objects.table1model — is not intuitive or descriptive.

Motivation

  • The current API output exposes internal model names instead of user-defined labels.
  • This makes automation, audits, and API-based permission management harder because:
    • Custom object types cannot be reliably identified by their friendly name.
    • Users must guess or map these model names manually.
  • The UI already shows friendly labels (“Custom Objects > DHCP Option”), so the API should ideally align with this.

Proposed Behavior

Update the API to return user-friendly identifiers for custom object types. For example:

"object_types": [
    "custom_objects.dhcp_option"
]

Use case

We manage permissions for Custom Object Types programmatically using the API (e.g., syncing permissions across environments).
When the API returns only the internal Django model identifier (netbox_custom_objects.table1model), it becomes difficult to:

  • Identify which custom object type a permission refers to
  • Build automation scripts that rely on stable, human-readable labels
  • Synchronize permissions between test/prod environments where internal model names may differ
  • Present meaningful information in internal dashboards or CI/CD pipelines

Having user-friendly labels in the API would allow us to reliably map permissions to the custom object types our teams recognize (e.g., DHCP Option) and ensure consistent automation and reporting.

External dependencies

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions