Refactor NetBoxModelViewSet to allow the creation of read-only API endpoints #7574

Closed
opened 2025-12-29 20:25:35 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jan 27, 2023).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Break out the methods of NetBoxModelViewSet which are not specific to write requests into a separate mixin or set of mixins. This should be done in a manner that backward compatibility for existing plugins is fully retained.

Justification

The NetBoxModelViewSet class is currently written with the assumption that all REST API endpoints will support the full suite of CRUDL functionality. However, in some cases it may be desirable to employ read-only endpoints which still leverage custom NetBox functionality, such as export template support. A recent example of this is FR #11558, which introduces a DataFile model that should not be mutable via the REST API, however it's likely we'll encounter similar requirements in the future.

Originally created by @jeremystretch on GitHub (Jan 27, 2023). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Break out the methods of `NetBoxModelViewSet` which are not specific to write requests into a separate mixin or set of mixins. This should be done in a manner that backward compatibility for existing plugins is fully retained. ### Justification The `NetBoxModelViewSet` class is currently written with the assumption that all REST API endpoints will support the full suite of CRUDL functionality. However, in some cases it may be desirable to employ read-only endpoints which still leverage custom NetBox functionality, such as export template support. A recent example of this is FR #11558, which introduces a `DataFile` model that should not be mutable via the REST API, however it's likely we'll encounter similar requirements in the future.
adam added the status: acceptedtype: housekeeping labels 2025-12-29 20:25:35 +01:00
adam closed this issue 2025-12-29 20:25:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7574