Sort by date for pagination

System Information
  • Strapi Version: 3.5.3
  • Operating System: ubuntu
  • Database: mysql
  • Node Version: 14.x
  • NPM Version: 6.x
  • Yarn Version:

What if I got 120 records, and want to sort by date first, then show 50 records in a page. how can i do such a task in api endpoint?
GET /users?_sort=date:DESC
GET /users?_start=0&_limit=50
GET /users?_start=51&_limit=100

GET /users?_sort=date:DESC&_start=0&_limit=100

GET /users?_sort=date:DESC&_start=100&_limit=100

1 Like

Could you update this?
Seems outdated


Queries can accept a sort parameter that allows sorting on one or multiple fields with the following syntaxes:

  • GET /api/:pluralApiId?sort=value to sort on 1 field
  • GET /api/:pluralApiId?sort[0]=value1&sort[1]=value2 to sort on multiple fields (e.g. on 2 fields)

The sorting order can be defined with:

  • :asc for ascending order (default order, can be omitted)
  • or :desc for descending order.

Here’s the updated one :-
GET /users?sort[0]=date&pagination[limit]=50