Pagination
All resources that are returned as a list are paginated and sorted by their creation date in descending order (latest first). The default items per page is 10
. A list of paginated resources will return in the format as follows
items
(array) – List of resource objects.has_more
(boolean) – Whether there are more resources or not after the last object in the list.
{
"items": [],
"has_more": false
}
You can page through the list by specifying the following query string parameters.
limit
(number) – Integer between 10 and 100. The number of resources to return.cursor
(string) – The id of the resource to start the list with, but excluding that resource.cursor_direction
–asc
ordesc
– the order to sort the resources by.
For example, you can retrieve the first 100 most recent charge resources with the following request
curl -h 'Authorization: Bearer {secret}.{jwt}' https://api.univapay.com/charges?limit=100
{
"items": [
{
"id": "4050058b-646a-4fae-8876-babf0dc0c3f0"
...
},
...
{
"id": "34daac6d-63a8-485b-a9ea-75a2e24a258d"
...
}
],
"has_more": true
}
Since the has_more = true
indicates there are more charges, another request can be made to to receive the next page. Using 34daac6d-63a8-485b-a9ea-75a2e24a258d
as the cursor
, the request to get the next 100 charges in the list should be:
curl -h 'Authorization: Bearer {secret}.{jwt}' https://api.univapay.com/charges?cursor=34daac6d-63a8-485b-a9ea-75a2e24a258d&limit=100