device api - return related rack reservation(s) #10930

Closed
opened 2025-12-29 21:37:54 +01:00 by adam · 2 comments
Owner

Originally created by @ITJamie on GitHub (Mar 21, 2025).

NetBox version

v4.2.5

Feature type

Data model extension

Proposed functionality

add "rack_reservations" to device responses.

Use case

when a device is in a rack and has a position. it would be great if the api response had a "rack_reservations" block which contained the reference of the reservation is a part of.

right now its a good bit of work to track down the related rack reservation of a racked device.

Database changes

n/a

External dependencies

No response

Originally created by @ITJamie on GitHub (Mar 21, 2025). ### NetBox version v4.2.5 ### Feature type Data model extension ### Proposed functionality add "rack_reservations" to device responses. ### Use case when a device is in a rack and has a position. it would be great if the api response had a "rack_reservations" block which contained the reference of the reservation is a part of. right now its a good bit of work to track down the related rack reservation of a racked device. ### Database changes n/a ### External dependencies _No response_
adam added the type: feature label 2025-12-29 21:37:54 +01:00
adam closed this issue 2025-12-29 21:37:54 +01:00
Author
Owner

@ITJamie commented on GitHub (Mar 21, 2025):

note i say rack_reservations as it is technically possible for a device to be split across multiple reservations in a rack.

@ITJamie commented on GitHub (Mar 21, 2025): note i say rack_reservations as it is technically possible for a device to be split across multiple reservations in a rack.
Author
Owner

@jnovinger commented on GitHub (Mar 27, 2025):

This seems like a poor use for the Device API endpoint. If you need to find the rack reservations for a device, then you want to use the Rack Reservation endpoint (at /api/dcim/rack-reservations/). The device representation in the device API is already pretty heavy, which is one of the main reasons to have a separate endpoint like this.

Perhaps we could add a device_id filter for the Rack Reservation endpoint. If you'd like to pursue that, please file a new FR.

@jnovinger commented on GitHub (Mar 27, 2025): This seems like a poor use for the Device API endpoint. If you need to find the rack reservations for a device, then you want to use the Rack Reservation endpoint (at `/api/dcim/rack-reservations/`). The device representation in the device API is already pretty heavy, which is one of the main reasons to have a separate endpoint like this. Perhaps we could add a `device_id` filter for the Rack Reservation endpoint. If you'd like to pursue that, please file a new FR.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10930