Rebrandly for Developers

Use our API to create, track and share custom short links that incorporate your brand domain name.

Get Started

Sorting collections

A collection of resources can be sorted (either descending or ascending) according to a given criteria.

Sorting criteria

Sorting criteria is the sorting mode to be applied on a collection before pagination (see Understanding Pagination) applies.

Every resource collection management endpoint comes with an orderBy parameter used to define which sorting criteria has to be applied.

Examples of an orderBy parameter's possible values are: createdAt (to sort by creation datetime), updatedAt (to sort by last update date/time) and so on.

Sorting direction

Sorting direction is the direction, according to sorting criteria, to be applied on a collection before pagination applies. The only two possible directions are "ascending" (from first to last) and "descending" (from last to first).

Every resource collection management endpoint comes with an orderDir parameter used to define which sorting direction has to be applied.
Possible values for orderDir are asc (ascending) and desc (descending).

Combining sorting criteria

To exploit the full power of sorting criteria, it is possible to combine two sorting criteria together:

First, sort by descending X, then sort by ascending Y if X subsequent X values are equal,
can be obtained by assigning orderBy parameter value X,Y and by assigning orderDir parameter value desc,asc.

Sorting collections


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.