Add a url field to all REST API serializers #3821

Closed
opened 2025-12-29 18:31:22 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jun 30, 2020).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Currently, all nested serializers include a url attribute containing a link to their corresponding detail view. For example, when viewing the assigned site of a device, the site representation includes a url indicating where to retrieve the full site representation via the REST API. This issue proposes extending this field to the full object serializers as well.

Justification

  1. Ensures that url is consistently available on all serialized representations.
  2. Allows directly referencing a specific object's location from within a list view without requiring the client to calculate the URL.

This may be a bit redundant when viewing single objects, however there's still an argument to be made for the utility of easily replicating the current request by simply referencing the url field.

Originally created by @jeremystretch on GitHub (Jun 30, 2020). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Currently, all nested serializers include a `url` attribute containing a link to their corresponding detail view. For example, when viewing the assigned site of a device, the `site` representation includes a `url` indicating where to retrieve the full site representation via the REST API. This issue proposes extending this field to the full object serializers as well. ### Justification 1. Ensures that `url` is consistently available on all serialized representations. 2. Allows directly referencing a specific object's location from within a list view without requiring the client to calculate the URL. This may be a bit redundant when viewing single objects, however there's still an argument to be made for the utility of easily replicating the current request by simply referencing the `url` field.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:31:22 +01:00
adam closed this issue 2025-12-29 18:31:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3821