Most routes that return a list of objects will support sorting and pagination. When they do, they will do so with a standard language, described here.
You can sort objects returned using the parameters sort_by
and sort_dir
.
sort_dir
can take the values "asc"
or "desc"
.
sort_by
values will generally be the same name as create or update parameters, though often limited to a subset of the possible options. For example, many resources can be provided the parameter sort_by=name
. You can also usually sort by id
, created_at
, and updated_at
. Invalid sort options will result in a response:
{"code":400,"error":{"type":"parameter_error","message":"Unacceptable value for parameter: 'sort_by'","items":["sort_by"]}}
Any route that supports pagination will return a pagination
key in the response data. You can query for different pages using the page
parameters. You can change the number of results per page using the per_page
parameter.