Pagination
Some cool info and strategies about how to handle Belvo's pagination.
Use the
link
query parameter when listingWe strongly recommend that you use the
link
query parameter in your List requests so that you only receive results for a givenlink.id
.
Increase page_size
When using the List method, by default you will receive 100 results per page. However, you can increase this to a maximum of 1000 results using the page_size
query parameter:
curl --request GET \
--url 'https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000'
Navigation properties
In the response for any List request, you will receive navigation properties in the root of the response to aid you in your subsequent requests:
{
"count": 3542,
"next": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=2",
"previous": null,
"results": [] // Up to 1000 results, depending on page_size parameter.
}
Parameter | Description |
---|---|
count | The total number of results for your query. |
next | If available, the next page of results. If no page is available, this is set to null . |
previous | If available, the previous page of results. If no page is available, this is set to null . |
results | An array of results for your query. |
In the case that there are more results than the upper limit set by page_size
, You will need to use the value of the next
parameter to receive the next page of results (which uses the page
query parameter).
For example, in the case that you make the following List call, setting page_size
to 1000
:
curl --request GET \
--url 'https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000' \
--header 'accept: application/json'
You will receive the following JSON response:
{
"count": 3542,
"next": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=2",
"previous": null,
"results": [] // Up to 1000 results
}
Propagated query parameters
As you can see in the examples, any query parameters that you provide are then propagated to the
next
value. For example, in the initial request we send through?link=link_id&page_size=1000
, and in the response, we can see that these query parameters are persisted in the new URL in thenext
parameter:?link=link_id&page_size=1000&page=2
.
You can then use the URL in the next
parameter to make your following API calls until next
is equal to null
. In the code block below we provide you an example of all the responses given this situation:
{
"count": 3542,
"next": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=2",
"previous": null,
"results": [] // Up to 1000 results
}
{
"count": 3542,
"next": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=3",
"previous": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=1",
"results": [] // Up to 1000 results
}
{
"count": 3542,
"next": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=4",
"previous": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=2",
"results": [] // Up to 1000 results
}
{
"count": 3542,
"next": null,
"previous": "https://sandbox.belvo.com/api/transactions/?link=link_id&page_size=1000&page=3",
"results": [] // Up to 1000 results
}
Updated about 1 month ago