Pagination
Walking Through Results
Archie's list endpoints return a page at a time. You ask for a window with limit and offset, and each response tells you how many rows exist in total and whether another page is waiting.
How It Works
A list call takes two query parameters. limit is how many rows you want, up to 100, and it defaults to 20. offset is how many rows to skip, and it defaults to 0. To read the next page, add the limit to the offset and call again.
Every list response carries a pagination object alongside your rows. Read has_more to decide whether to keep going; you do not have to do the arithmetic against total yourself.
| Field | Meaning |
|---|---|
total | How many rows match in full, across every page. |
limit | The page size you asked for (echoed back). |
offset | How many rows were skipped to reach this page. |
has_more | True when another page exists past this one. |
a list responsejson
{
"data": [ /* up to "limit" rows */ ],
"pagination": {
"total": 137,
"limit": 20,
"offset": 0,
"has_more": true
}
}Reading Every Page
Loop until has_more is false, advancing the offset by the limit each time.
paginate.pypython
def fetch_all(client, skill, page_size=100):
rows, offset = [], 0
while True:
page = client.skills.invoke(skill, {"limit": page_size, "offset": offset})
rows.extend(page["data"])
if not page["pagination"]["has_more"]:
return rows
offset += page_sizeHold the limit steady
Keep the same
limit across a run. Because offset counts rows rather than pointing at a specific one, changing the page size partway through can skip or repeat a row near the boundary.