Pagination
Long lists are paged with page and per_page. Short lists are returned whole.
page and per_page#
| Parameter | Meaning |
|---|---|
page | 1-based page number. Default 1. |
per_page | Rows per page. Default 25, at most 50. A larger value is refused with 422. |
The response tells you where you are:
| Field | Meaning |
|---|---|
meta.total | How many rows match your filters in all. Left out when zero. |
meta.has_next | true when another page follows. Left out when false. |
meta.has_prev | true when an earlier page exists. Left out when false. |
curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/teachings?page=2&per_page=25&status=done" \
-H "Authorization: Bearer $LECTERN_API_KEY"Stop on has_next
Loop until meta.has_next is missing or false. Do not compute the number of pages from total and per_page: a page can be smaller than you asked for.
Which routes are paged#
GET /teachingsis paged and filterable byq,status,branch_id,series_idandteacher_id.GET /series,GET /teachers,GET /webhooks,GET /uploadsandGET /webhooks/{id}/deliveriesreturn a short, bounded list. They are not paged.GET /searchreturns the best matches for your query, not a page of everything.
Consistency while paging#
Teachings are returned newest first. If a teaching is added while you page, rows can shift between pages, so a row may appear twice. De-duplicate on id when you build a full copy.