Pagination

The list envelope and how to page through orders and vouchers.

Every list endpoint answers an object with a data field, never a bare array. GET /api/v1/availability/starts returns {"data": [...]} and GET /api/v1/services returns {"data": {categories, services, packages}}. Single resources (GET /orders/{id}, GET /gift-vouchers/{code}, GET /me, GET /availability/calendar) are bare objects.

Paged lists

GET /api/v1/orders and GET /api/v1/gift-vouchers add a meta field:

{ "data": [], "meta": { "page": 1, "perPage": 20, "total": 137 } }

Request pages with two query parameters.

ParameterDefaultNotes
page11-based
perPage20Maximum 100

An unconvertible value such as ?page=abc is 400 INVALID_INPUT.

curl "https://api.shyni.io/api/v1/orders?page=2&perPage=100" \
  -H "Authorization: Bearer $SHYNI_KEY"

Walking all pages

const all = [];
for (let page = 1; ; page++) {
  const res = await fetch(`${API}/orders?page=${page}&perPage=100`, { headers });
  const { data, meta } = await res.json();
  all.push(...data);
  if (page * meta.perPage >= meta.total) break;
}

Each page is a call, and every successful call counts towards a secret key's quota; see Rate limits and quota. Filter instead of walking when you can: see List orders.

On this page