Command Palette

Search for a command to run...

Log In
  1. Reference
  2. API
  3. Pagination, Filtering & Sorting

Pagination, Filtering & Sorting

Overview

Endpoints that return a list of records, such as GET /public/v1/participants, return paginated results. Many list endpoints also accept filters or sorts. The available parameters differ by endpoint, so check the operation in the interactive API reference.

Response shape

List responses wrap the records in a data array and include a meta object describing the current page:

{
  "data": [
    { "id": "9ee9dc30-c869-4fb5-9871-b32850e68cad", "full_name": "Edd Romaguera" }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 4,
    "per_page": 25,
    "total": 94,
    "allowed_sorts": []
  }
}
  • current_page and last_page show your position in the result set.
  • per_page is the number of records returned on each page.
  • total is the number of matching records.
  • allowed_sorts lists the fields accepted by that endpoint's sort parameter. An empty array means that endpoint does not offer sorting.

Pagination

Control paging with the page query parameters:

ParameterDefaultNotes
page[number]1Page to return.
page[size]25Records per page. Values are limited to the range 1 to 100.
# Second page, 50 records per page
curl --globoff "https://api.app.astalty.com.au/public/v1/participants?page[number]=2&page[size]=50" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

To retrieve the full result set, increment page[number] until meta.current_page equals meta.last_page.

Filtering

Narrow a list with filter[...] parameters. The interactive API reference lists each endpoint's accepted filter names, values and comma-separated options.

# Active participants only
curl --globoff "https://api.app.astalty.com.au/public/v1/participants?filter[status]=active" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Sorting

Sort a list with the sort parameter and a field from meta.allowed_sorts. Prefix a field with a minus sign (-) for descending order. Some endpoints accept more than one comma-separated sort.

# Newest exports first
curl "https://api.app.astalty.com.au/public/v1/exports?sort=-created_at" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"