To fetch the next page, set the cursor parameter to the pagination.cursor value returned in the last response.
Example request:
GET https://api.paytsoftware.com/v1/invoices?administration_id=81&cursor=2897875
Authorization: Bearer IBzLDErQvt9gOmSLarUtDy06emduHZmKEG2OSPdHpJ8
Response:
{
"data": [
{
"category": null,
"currency_code": "EUR",
"description": null,
"debtor_id": 543239,
"id": 2603746,
"invoice_number": "JbV9Jgka1oA",
"purchase_order_number": null,
"order_number": "7431989686",
"payment_date": null,
"due_date": "2019-05-15",
"invoice_date": "2019-05-01",
"total_amount": "5182.00",
"open_amount": "5182.00",
"book_open_amount": "5182.00",
"book_total_amount": "5182.00",
"collectable_at": null,
"debt_collection_at": null,
"final_reminder_at": null,
"latest_reminder_at": null,
"sent_at": "2019-04-30T22:00:00Z"
}
],
"pagination": {
"cursor": 2603755
}
}
Syncing data
The updated_after parameter requests only records that have changed since a given timestamp (for instance, the last time data was synced). When the last page of data is processed, store the updated_at timestamp of the most recently updated record in the last response and use it to fetch all updated records in a future run.
When a response contains no records, reuse the previous updated_at timestamp for the next sync session: do not advance it, or you may skip records.