Pagination
Lists come a page at a time, newest first. Follow the cursor to get the next page.
Parameters and shape
limit: how many per page, 1 to 100. Default 20.cursor: thenext_cursorof the previous page. Treat it as an opaque string.
Every list answers { object: "list", data, has_more, next_cursor }. When has_more is false, next_cursor is null. Lists: GET /shipments, GET /events and GET /webhook-endpoints.
Every page, in JavaScript
JavaScript
let cursor = null;
do {
const url = new URL('https://api.evipostal.com/v1/shipments');
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.EVIPOSTAL_API_KEY}` },
});
const page = await response.json();
for (const shipment of page.data) console.log(shipment.id, shipment.status);
cursor = page.has_more ? page.next_cursor : null;
} while (cursor);