fixes #21139 support api filter for core #554

Closed
opened 2026-04-05 16:43:23 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @antoinekh on 1/16/2026

Fixes: #21139

Changes to support filter fields on the core API.

I replace the ReadOnlyModelViewSet with the NetBoxReadOnlyModelViewSet

For the ObjectTypeViewSet, I discovered that it is a public endpoint and so modifications were necessary. I used IA for this one. It works, but I am not sure if this is the best implementation for Netbox.
Please feel free to change it. I am open to any ideas.

This have been tested with success on the 3 views with and without the filter fields.
CI check pipeline OK

GET /api/core/object-changes/?fields=time
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
        {
            "time": "2026-01-15T09:32:04.510666Z"
        },
        {
            "time": "2026-01-15T09:32:00.163794Z"
        },
        {
            "time": "2026-01-15T09:31:46.696713Z"
        }
    ]
}
*Originally created by @antoinekh on 1/16/2026* <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #21139 Changes to support filter fields on the core API. I replace the `ReadOnlyModelViewSet` with the `NetBoxReadOnlyModelViewSet` For the ObjectTypeViewSet, I discovered that it is a public endpoint and so modifications were necessary. I used IA for this one. It works, but I am not sure if this is the best implementation for Netbox. Please feel free to change it. I am open to any ideas. This have been tested with success on the 3 views with and without the filter fields. CI check pipeline OK ``` GET /api/core/object-changes/?fields=time HTTP 200 OK Allow: GET, HEAD, OPTIONS Content-Type: application/json Vary: Accept { "count": 3, "next": null, "previous": null, "results": [ { "time": "2026-01-15T09:32:04.510666Z" }, { "time": "2026-01-15T09:32:00.163794Z" }, { "time": "2026-01-15T09:31:46.696713Z" } ] } ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#554