Sort

You can sort a collection by using the orderBy parameter and specifying the attributes to sort by and the sorting sequence (ascending or descending).

Sort by a Single Attribute

To sort a collection by a single attribute, use the orderBy parameter and specify the attribute name. Here's an example.

GET /hcmRestApi/resources/11.13.18.05/workers?q=names.FirstName like '%K%'&expand=names&orderBy=DateOfBirth

Sort a Single Attribute by Sequence

To sort a collection by a single attribute by sequence, use the orderBy parameter and specify the attribute name and the sorting sequence. Here's an example.

GET /hcmRestApi/resources/11.13.18.05/workers?q=names.FirstName like '%K%'&expand=names&orderBy=DateOfBirth:desc

Sort by Multiple Attributes

To sort a collection by multiple attributes, use the orderBy parameter and specify the attribute names and the sorting sequence. Here's an example.

GET /hcmRestApi/resources/11.13.18.05/workers?q=names.FirstName like '%K%'&expand=names&orderBy=DateOfBirth,RegionOfBirth:desc