Add a stable script identifier to Extras Scripts API #11928

Open
opened 2025-12-29 21:51:37 +01:00 by adam · 0 comments
Owner

Originally created by @pergus on GitHub (Dec 16, 2025).

NetBox version

v4.4.8

Feature type

Other

Proposed functionality

When listing scripts via the Extras Scripts API (/api/extras/scripts/), there isn’t a field that shows the fully qualified script name, like demo.Echo.

The API currently gives you id, name, and display, but none of these make it easy to identify a script:

  • id works for execution but isn’t predictable or portable
  • name isn’t unique — multiple scripts can have the same class name
  • display is meant for humans, not automation

This makes it tricky to figure out which script in the API corresponds to a specific script in code.

Proposed change

Add a read-only field called script_name that contains the module and class name, e.g.:

"script_name": "demo.Echo"

Where:

  • demo is the script module (the file name without .py)
  • Echo is the script class name

Example

Current output:

{
    "id": 68,
    "url": "http://localhost:8000/api/extras/scripts/68/",
    "display_url": "http://localhost:8000/extras/scripts/68/",
    "module": 118,
    "name": "Echo",
    "description": "Echo back any json sent to it",
    "vars": {},
    "result": null,
    "display": "Echo (demo)",
    "is_executable": true
}

Proposed output:

{
    "id": 68,
    "url": "http://localhost:8000/api/extras/scripts/68/",
    "display_url": "http://localhost:8000/extras/scripts/68/",
    "module": 118,
    "name": "Echo",
    "script_name": "demo.Echo",
    "description": "Echo back any json sent to it",
    "vars": {},
    "result": null,
    "display": "Echo (demo)",
    "is_executable": true
}

Use case

Why this helps

  • Gives a stable, human-readable identifier for scripts
  • Avoids confusion when multiple scripts have the same class name
  • Makes it easier to reference custom scripts from external scripts.

Database changes

No response

External dependencies

No response

Originally created by @pergus on GitHub (Dec 16, 2025). ### NetBox version v4.4.8 ### Feature type Other ### Proposed functionality When listing scripts via the Extras Scripts API (`/api/extras/scripts/`), there isn’t a field that shows the fully qualified script name, like `demo.Echo`. The API currently gives you `id`, `name`, and `display`, but none of these make it easy to identify a script: * `id` works for execution but isn’t predictable or portable * `name` isn’t unique — multiple scripts can have the same class name * `display` is meant for humans, not automation This makes it tricky to figure out which script in the API corresponds to a specific script in code. ### Proposed change Add a read-only field called `script_name` that contains the module and class name, e.g.: ```json "script_name": "demo.Echo" ``` Where: * `demo` is the script module (the file name without `.py`) * `Echo` is the script class name ### Example Current output: ```json { "id": 68, "url": "http://localhost:8000/api/extras/scripts/68/", "display_url": "http://localhost:8000/extras/scripts/68/", "module": 118, "name": "Echo", "description": "Echo back any json sent to it", "vars": {}, "result": null, "display": "Echo (demo)", "is_executable": true } ``` Proposed output: ```json { "id": 68, "url": "http://localhost:8000/api/extras/scripts/68/", "display_url": "http://localhost:8000/extras/scripts/68/", "module": 118, "name": "Echo", "script_name": "demo.Echo", "description": "Echo back any json sent to it", "vars": {}, "result": null, "display": "Echo (demo)", "is_executable": true } ``` ### Use case ## Why this helps * Gives a stable, human-readable identifier for scripts * Avoids confusion when multiple scripts have the same class name * Makes it easier to reference custom scripts from external scripts. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: under reviewnetbox labels 2025-12-29 21:51:37 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11928