Order list API results by id ascending
When working with paginated resources, the order of results should be stable by default. Currently results are ordered created_at DESC
which means every time a new item is created the results change. This might be what a user wants but it shouldn't be the default.
https://gitlab.com/gitlab-org/gitlab-ce/issues/42661:
All APIs that do pagination should do that in such a way that the pagination order corresponds to the insertion order into the table (i.e. usually return things in primary key order), so that API consumers don't need to deal with cases where the same record is returned twice because something got inserted
Proposal
- Order paginated API results by
id ASC
by default, which means the entire list can be paged through without missing items - Allow paginated API results to be ordered by
created_at DESC
if the user wants