Pagination#
- All endpoints returning lists support pagination. The response is divided into 3 objects:
data
- containing list of resourceslinks
- containing pagination linksmeta
- containing list’s metadata
- GET /resources#
Return paginated resources.
- Query Parameters:
limit (integer, optional) – maximal number of entries per page
page (integer, optional) – fetched page number
cursor (string, optional) – paging cursor
- Response JSON Object:
data (array) – list of resources
links.first (string) – URL of first page
links.last (string) – URL of last page
links.prev (string, null) – URL of previous page, may be null if current page is first
links.next (string, null) – URL of next page, may be null if current page is last
meta.path (string) – URL of request
meta.cursor (string) – paging cursor
meta.total (integer) – total number of resources
meta.from (integer) – position of the first element on page
meta.to (integer) – position of the last element on page
meta.perPage (integer) – maximal number of resources on page
meta.currentPage (integer) – current page number
meta.lastPage (integer) – last page number
Example request:
GET /api/v2/resources?limit=10&page=2 HTTP/1.1 Host: app.example.com Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "data": ["..."], "links": { "first": "https://app.example.com/api/v2/resources?cursor=eyJpZCI6MzkzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9&page=1", "last": "https://app.example.com/api/v2/resources?cursor=eyJpZCI6MzkzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9&page=4", "prev": "https://app.example.com/api/v2/resources?cursor=eyJpZCI6MzkzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9&page=1", "next": "https://app.example.com/api/v2/resources?cursor=eyJpZCI6MzkzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9&page=3" }, "meta": { "path": "https://app.example.com/api/v2/resources", "cursor": "eyJpZCI6MzkzLCJfcG9pbnRzVG9OZXh0SXRlbXMiOnRydWV9", "total": 35 "from": 11, "to": 20, "perPage": 10, "currentPage": 2, "lastPage": 4, } }