API Working Group/Current Design/Sorting
Sorting is determined through the use of the 'sort_key' and 'sort_dir' query string parameters; the caller can specify these multiple times in order to generate a list of sort keys and directions.
The following sort direction values are supported:
The valid sort keys are based on the project's data model.
The sort keys and directions are applied in the order in which they are specified as query string parameters. For example, the following specifies 'key1' to be the first sort key (in ascending order), 'key2' to be the second sort key (in descending order), etc.:
The REST APIs for the projects listed below support sort keys and sort directions to varying degrees, ranging from multiple keys and directions to a single key and a single direction.
Some projects also append default sort keys to the list of user-defined keys.
The table below summarizes the current behavior:
|Project||Number of Sort Keys||Number of Sort Directions||Default Keys||Default Direction|
Additional project-specific information can be found below.
Supports fewer sort directions supplied then sort keys; any keys without an associated direction have a default direction applied.
Requires an equal number of sort keys and sort directions.
This BP proposes support for multiple sort keys and multiple sort directions
Glance supports a multiple sort keys and a single sort direction; the sort direction is applied to all keys.
Heat supports a multiple sort keys and a single sort direction; the sort direction is applied to all keys.