Add examples for ordering results to REST API documentation #9438

Closed
opened 2025-12-29 20:49:57 +01:00 by adam · 4 comments
Owner

Originally created by @jeremystretch on GitHub (Apr 4, 2024).

Change Type

Addition

Area

Integrations/API

Proposed Changes

Add a brief section on ordering to the REST API documentation, including examples. For instance,

GET /api/dcim/sites/?ordering=-name

will return all sites sorted by name in reverse alphabetical order.

Originally created by @jeremystretch on GitHub (Apr 4, 2024). ### Change Type Addition ### Area Integrations/API ### Proposed Changes Add a brief section on ordering to the REST API documentation, including examples. For instance, ``` GET /api/dcim/sites/?ordering=-name ``` will return all sites sorted by name in reverse alphabetical order.
adam added the status: acceptedtype: documentation labels 2025-12-29 20:49:57 +01:00
adam closed this issue 2025-12-29 20:49:57 +01:00
Author
Owner

@muTeREdO commented on GitHub (Apr 4, 2024):

This is technically covered in the docs/reference/filtering.md documentation.

I do have a slight modification based on your feedback that shows a brief example building off the filtering example under Endpoint Hierarchy. I'd be happy to put a PR in for it.

@muTeREdO commented on GitHub (Apr 4, 2024): This is technically covered in the [docs/reference/filtering.md](https://github.com/netbox-community/netbox/blob/develop/docs/reference/filtering.md) documentation. I do have a slight modification based on your feedback that shows a brief example building off the filtering example under [Endpoint Hierarchy](https://github.com/netbox-community/netbox/blob/develop/docs/integrations/rest-api.md#endpoint-hierarchy). I'd be happy to put a PR in for it.
Author
Owner

@jeremystretch commented on GitHub (Apr 4, 2024):

This is technically covered in the docs/reference/filtering.md documentation.

Ha, I thought we had added it at some point. Maybe we should just add a note & link on the main API documentation to it. @muTeREdO happy to assign this to you if you'd like to own it.

@jeremystretch commented on GitHub (Apr 4, 2024): > This is technically covered in the [docs/reference/filtering.md](https://github.com/netbox-community/netbox/blob/develop/docs/reference/filtering.md) documentation. Ha, I _thought_ we had added it at some point. Maybe we should just add a note & link on the main API documentation to it. @muTeREdO happy to assign this to you if you'd like to own it.
Author
Owner

@muTeREdO commented on GitHub (Apr 4, 2024):

@jeremystretch, sure assign it over and I'll take care of it!

@muTeREdO commented on GitHub (Apr 4, 2024): @jeremystretch, sure assign it over and I'll take care of it!
Author
Owner

@muTeREdO commented on GitHub (Apr 4, 2024):

PR submitted.

@muTeREdO commented on GitHub (Apr 4, 2024): [PR submitted.](https://github.com/netbox-community/netbox/pull/15627)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9438