api v2 pagination
API V2 uses two methods of data pagination. Individual documentation of each endpoint specifies what type of pagination is used by given endpoint.
Offset pagination
To fetch the first page of entries in a collection, the API needs to be called either without the offset
parameter, or with the offset
set to 0
. Optional limit
field specifies how many records each page should contain.
- https://api.infinex.cc/wallet/v2/assets
- https://api.infinex.cc/wallet/v2/assets?limit=5
- https://api.infinex.cc/wallet/v2/assets?offset=0
- https://api.infinex.cc/wallet/v2/assets?offset=0&limit=5
Each response contains an array of records and boolean more
field that informs whether next page is available or not.
{
"assets": [
...
],
"more": true
}
To fetch the next page of entries the API needs to be called with an offset
parameter that equals the sum of the previous offset
value and count of items in previous page response.
- https://api.infinex.cc/wallet/v2/assets?offset=5
- https://api.infinex.cc/wallet/v2/assets?offset=5&limit=5
Cursor pagination
To fetch the first page of entries, the API needs to be called without the cursor
parameter. Optional limit
field specifies how many records each page should contain.
Each response contains an array of records and the cursor
field, which can be null
if there is no next page, or integer value if next page is available.
{
"popups": [
...
],
"cursor": 5
}
To fetch the next page of entries the API needs to be called with a cursor
query parameter equal to cursor
value from previous page response.
No Comments