Skip to content

Add URL field on API responses that provides the NetBox UI URL to an object #15156

Closed
@ITJamie

Description

@ITJamie

NetBox version

4.0.2

Feature type

New functionality

Proposed functionality

When using the Rest API the URL field on objects has direct API URLs.
It would be great if there was a display_url or ui_url to use when referencing the object in external tools.

Removing /api from the the existing url field on API response doesn't always work to get to a valid UI URL.

This could be an optional non-default field that could be requested if needed now that #15087 is possible.

examples of what this could look like:

VM API response:

{
    "id": 361,
    "url": "https://demo.netbox.dev/api/virtualization/virtual-machines/361/",
    "ui_url": "https://demo.netbox.dev/virtualization/virtual-machines/361/",
    "display": "vm1",
    "name": "vm1",
 <truncated>

VM Disk response:

{
    "id": 1,
    "url": "https://demo.netbox.dev/api/virtualization/virtual-disks/1/",
    "ui_url: "https://demo.netbox.dev/virtualization/disks/1/",
    "display": "disk1",
 <truncated>

Use case

When using the API sometimes we send slack alerts or emails for specific issues we find with data for a human to visit and interfact with / fix.

With most objects we can strip /api from the URL and give that URL to users, however not all objects follow that (e.g. virtual disks on VMs)

Example:

  • UI URL: http://netbox_instance/virtualization/disks/1/
  • API URL: http://netbox_instance/api/virtualization/virtual-disks/1/

Database changes

N/A

External dependencies

N/A

Metadata

Metadata

Assignees

Labels

complexity: lowRequires minimal effort to implementstatus: 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