- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.9k
 
Description
NetBox version
v4.3.6
Feature type
New functionality
Proposed functionality
With the implementation of pagination in #16224, I thought that might have also introduced ordering, but that does not seem to be the case. Therefore, I propose ordering as an additional argument alongside filters and pagination when accessing non-scalar types. It would work the same as the ordering argument in the REST API, but should probably be turned into an array of strings instead of a single comma-separated string.
Use case
I need to pull nested data from NetBox and using the REST API does not allow that without N+1 queries. Initially, I wrote an export template to solve this problem, but as the output format needs to be JSON, that started becoming tedious, so I decided to explore the possibility of using GraphQL instead. It ended up being fairly straightforward to get the shape of the data I needed, but I was disappointed to find that ordering was not possible. In my case, I am grabbing the members of a virtual chassis and I need them in order of vc_position, not name, as they seem to be by default. My hope was that I could unmarshal the JSON response directly without additional processing.
Database changes
None
External dependencies
None