Pagination
List endpoints return the newest items first, a page at a time, and give you an opaque cursor for the next page.
These examples use a placeholder address. Your console shows the exact address of the API for your workspace.
Parameters#
limit: 1 to 100, default 20.cursor: thenext_cursorof the previous page. Treat it as an opaque string.
{
"data": [
"..."
],
"next_cursor": "eyJ0IjoiMjAyNi0xMC0xNFQwOTozMDowMFoiLCJpIjoiLi4uIn0"
}next_cursor is null on the last page. An invalid cursor is refused with 400 invalid_request. Do not build or edit cursors yourself: their content can change.
Reading every page#
let cursor = null;
do {
const url = new URL("https://api.vendrix.net/v1/connections");
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const page = await (await fetch(url, {
headers: { Authorization: `Bearer ${process.env.VENDRIX_API_KEY}` },
})).json();
for (const connection of page.data) console.log(connection.id);
cursor = page.next_cursor; // null on the last page
} while (cursor);