Pagination

Sorting and Pagination

The API resources facilitates sorting and pagination for endpoints returning resource arrays via bulk fetches.
Through the sorting process, the resources are ordered, after which the pagination process returns a particular segment of these sequenced resources.
The control of sorting and pagination lies with URL query parameters.

These list-based API methods all conform to a shared structure, accepting at the very least these three parameters:

  • sortBy
  • fromPage
  • limit

Example

curl https://api.kulipa.xyz/v1/cards?limit=10&fromPage=2&sortBy=-createdAt \
  -H "Content-Type: application/json" \
  -H "x-api-key: api_key_xxx"

Parameters

Query parameterDescriptionValues
sortBy (optional)Designate the field to sort on. The list of field to sort on is limited. Preface the field name with a hyphen (-) to sort in a descending order. Exclude the hyphen to sort in ascending order.Acceptable Values.
createdAt, updatedAt.

Default Value.
-createdAt
fromPage (optional)Designates the start page in the sort order from which data should be retrieved.Acceptable Values.
An integer.

Default Value.
0
limit (optional)A limit on the number of objects returned from the call.Acceptable Values.
1-100.

Default Value.
10

Pagination response format

Field nametypeDescription
pageintegerThe index of the page from the result
countintegerThe number of items returned.
has_morebooleanIndicates if more elements exist beyond this set. If it's false, this set represents the end of the list.
itemsobjects arrayA collection comprising the actual response elements, segmented according to any request parameters.

Example

{
  "page": 1,
  "count": 10,
  "has_more": true,
  "items": [
    ...
  ]
}