Pagination
Learn how to page through a PSU's list of transactions from Yapily's API.
Offset pagination
By default, Yapily limits the maximum amount of transactions returned in one request to GET Account Transactions to 1000. If you request contains more than this limit, you can use pagination access all transactions.
The following fields are used for pagination:
-
pagination.totalCount
- the total number of transactions your query would return -
pagination.self.limit
- the value of limit if specified in the request or 1000 if not specified -
offset
- the number of transaction records to be skipped
How it works
-
Send a request to GET Account Transactions. If
pagination.totalCount
is greater thanpagination.self.limit
then you haven't received the full number of transactions for your request. -
Execute the request again and specify the
offset
property to increment the number by X (where X is the value ofpagination.self.limit
). This will return the next X transactions. -
Repeat step 2 until
pagination.totalCount
is the same as or less thanpagination.self.limit
.
Examples
No limit specified
For a call to Get Account Transactions that had 6500 transactions without any limit, calling:
-
GET /accounts/{accountId}/transactions
returns transactions 1-1000 -
GET /accounts/{accountId}/transactions?offset=1000
returns transactions 1001-2000 -
GET /accounts/{accountId}/transactions?offset=6000
returns transactions 6001-6500
Specifying a limit
For a call to Get Account Transactions that had 467 transactions with a limit=50, calling:
-
GET /accounts/{accountId}/transactions?limit=50
returns transactions 1-50 -
GET /accounts/{accountId}/transactions?limit=50&offset=50
returns transactions 51-100 -
GET /accounts/{accountId}/transactions?limit=50&offset=450
returns transactions 451-467
Cursor-based pagination
Cursor-based pagination feature is currently available as a Private Beta version. Please contact your Customer Success Manager if you would like to access it.
Yapily's ‘Realtime transactions’ API endpoint is used to fetch transactions in real-time using cursor-based pagination.
It accepts from
and before
as optional query parameters when sending the initial request, and accepts cursor
as optional query parameter in subsequent requests.
How it works
Yapily doesn't set a limit
for the maximum number of transactions returned per page, but an individual Institution
can set a limit.
The meta
object in the response includes count
that represents the number of transactions in that page, but doesn't return a field for the total number of transactions.
The data
object in the response contains an array of transactions.
The links
object in the response returns opaque cursor tokens that can be fed into the subsequent request:
-
first
- a cursor or link to the first page -
prev
- a cursor or link to the previous page -
self
- a cursor or link to the current page -
next
- a cursor or link to the next page -
last
- a cursor or link to the last page
Examples
-
GET /accounts/{accountId}/real-time/transactions
to fetch transactions in the first page. Returnsself
,next
andlast
page cursors:
"links": {
"self": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=aaa",
"next": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=bbb",
"last": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=zzz"
}
-
GET /accounts/{accountId}/real-time/transactions?cursor=ccc
to fetch transactions in a middle page. Returnsfirst
,prev
,self
,next
andlast
page cursors:
"links": {
"first": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=aaa",
"prev": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=bbb",
"self": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=ccc",
"next": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=ddd",
"last": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=zzz"
}
-
GET /accounts/{accountId}/real-time/transactions?cursor=zzz
to fetch transactions in the final page. Returnsfirst
,prev
andself
page cursors:
"links": {
"first": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=aaa",
"prev": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=yyy",
"self": "https://api.yapily.com/accounts/{accountId}/real-time/transactions?cursor=zzz"
}