Whenever you make a request to get a list of resources from the API, it sets a default limit on the number of resources returned at 50*.
To retrieve results containing more records than the limit, the API returns an after parameter that can be used to send another request for the next set of results.
E.g. When you make a request to get a list of all your payments but the number of payments exceeds the limit
{
"payments": [
{
"id": "PM0001",
"created_at": "2017-06-14T04:32:45.482Z",
"charge_date": "2017-06-19",
"amount": 1000,
"description": "test",
"currency": "GBP",
"status": "paid_out",
"amount_refunded": 0,
"reference": null,
"metadata": {},
"links": {
"mandate": "MD00012345678",
"creditor": "CR00012345678",
"payout": "PO00012345678",
"subscription": "SB00012345678"
},
-------(FURTHER 49 PAYMENTS)-------
],
"meta": {
"cursors": {
"before": null,
"after": "PM00050"
},
"limit": 50
}
}
The after parameter allows you to then fetch the next set of results by making another call to the API e.g. https://api.gocardless.com/payments?after=PM00050
This will give you another JSON result with an after parameter. If after equals a null value, then you have reached the end of the results and you can stop making further requests.
*The default value for the number of records returned is 50, but this can be changed to 500 by setting the limit parameter with your request.