Terminations listed for a cable in the REST API should include their numeric IDs #9000

Closed
opened 2025-12-29 20:44:00 +01:00 by adam · 3 comments
Owner

Originally created by @jeremystretch on GitHub (Dec 26, 2023).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v3.6.7

Python Version

3.10

Steps to Reproduce

  1. Create a cable with one or more terminations on its A and B sides.
  2. View the cable's representation in the REST API (e.g. /api/dcim/cables/123/).

Expected Behavior

Each termination object represented under the cable's a_terminations and b_terminations attributes should include its own numeric primary key (ID).

Observed Behavior

This attribute is missing from the terminations. This is because the id field is not included on GenericObjectSerializer.

Originally created by @jeremystretch on GitHub (Dec 26, 2023). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v3.6.7 ### Python Version 3.10 ### Steps to Reproduce 1. Create a cable with one or more terminations on its A and B sides. 2. View the cable's representation in the REST API (e.g. `/api/dcim/cables/123/`). ### Expected Behavior Each termination object represented under the cable's `a_terminations` and `b_terminations` attributes should include its own numeric primary key (ID). ### Observed Behavior This attribute is missing from the terminations. This is because the `id` field is not included on GenericObjectSerializer.
adam closed this issue 2025-12-29 20:44:01 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 30, 2024):

Reclassifying this as a feature request, as the end result will simply be an intentional change to the way in which we present the serialized data.

@jeremystretch commented on GitHub (Aug 30, 2024): Reclassifying this as a feature request, as the end result will simply be an intentional change to the way in which we present the serialized data.
Author
Owner

@jeremystretch commented on GitHub (Sep 2, 2024):

This is going to be more involved than originally anticipated because each cable instance is pre-populated with its a_terminations and b_terminations attributes representing the terminating objects, rather than the CableTermination bindings.

@jeremystretch commented on GitHub (Sep 2, 2024): This is going to be more involved than originally anticipated because each cable instance is pre-populated with its `a_terminations` and `b_terminations` attributes representing the terminating objects, rather than the CableTermination bindings.
Author
Owner

@jeremystretch commented on GitHub (Nov 8, 2024):

Upon further consideration, I'm going to decline this FR: The current serializer structure is necessary to accommodate changes to a cable's terminations directly via CableSerializer. In situations where it's necessary to determine the IDs of CableTermination instances associated with a particular cable, these can be retrieved by querying the cable terminations endpoint (e.g. GET /api/dcim/cable-terminations/?cable=$id).

@jeremystretch commented on GitHub (Nov 8, 2024): Upon further consideration, I'm going to decline this FR: The current serializer structure is necessary to accommodate changes to a cable's terminations directly via CableSerializer. In situations where it's necessary to determine the IDs of CableTermination instances associated with a particular cable, these can be retrieved by querying the cable terminations endpoint (e.g. `GET /api/dcim/cable-terminations/?cable=$id`).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9000