Pagination
List operations in the Nodu API, such as List all transfers, return their results one page at a time. They share two request parameters and three response fields. Each list operation in the reference shows whether it takes these parameters.
Request a page
| Parameter | Meaning |
|---|---|
limit | How many objects to return, from 1 to 100. The default is 10. |
cursor | The position to continue from. Send the nextCursor value of the previous response. Leave it out to get the first page. |
Nodu refuses a limit outside this range with a 422 validation error.
For example, this call returns up to 50 transfers:
curl 'https://api.sandbox.nodu.fi/v1/transfers?limit=50' \
--header 'Authorization: Bearer <your-api-key>'
Most lists also accept filters, such as customerId. The reference lists the filters of each operation.
Read the response
| Field | Meaning |
|---|---|
data | The objects of this page, as an array. |
total | The number of objects that match the request, across all pages. It is not the size of this page. |
nextCursor | The cursor of the next page. The response contains it only when there are more results. |
On the last page the response has no nextCursor field. Treat a null value in the same way.
Order of results
A paginated list returns the most recently created objects first. No parameter changes the order.
Read all pages
- Send the request without
cursor. - Process the objects in
data. - If
nextCursoris present and is notnull, send the request again withcursorset to that value. Keeplimitand every filter the same. - Repeat steps 2 and 3. Stop when
nextCursoris absent ornull.
Three rules keep the loop correct:
- Send a cursor back exactly as you received it. Do not build a cursor and do not change one.
- Stop when
nextCursoris absent ornull, not when you have countedtotalobjects.totalcan change while you read, because objects are created in the meantime. - Objects created after you started are at the beginning of the list. If you have already read the first page, the remaining pages do not include these new objects. Start again from the first page to read them.
Next steps
- Errors and rule codes: the validation error that a wrong
limitreturns. - Track and cancel a transfer: reconcile your records with the list of transfers.