By default, unbounded lists (transactions, gateways, payment methods etc…) are ordered and paginated (these calls will be identified as such in their respective sections).
Order
Ordered responses are sorted by the created_at
attribute, oldest first. In the case where multiple timestamps are the same those records are then sorted alphabetically on the token attribute to give a consistent ordering.
Use the order
parameter to reverse the list order to most recent first.
Here is an example of sorting gateways in descending order:
GET /v1/gateways.<format>?order=desc HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>
GET /v1/gateways.<format>?order=desc HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>
URL parameters
Name | Description |
---|---|
order | The order of the returned list. Default is asc , which returns the oldest records first. To list newer records first, use desc . |
Pagination
By default, unbounded lists are returned in groups of 20 items. If there are more than 20 items in the list, use pagination to retrieve the next set of 20.
To enforce determinism in a real-time system, pagination is indexed based on a specific record (as opposed to just a page number as is common in many web-apps). To paginate to the next page, simply pass in the token of the last record in the current result set.
GET /v1/gateways.<format>?since_token=<since_token> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>
GET /v1/gateways.<format>?since_token=<since_token> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>
For instance, if the token of the last gateway in the initial set of twenty gateways returned is CtehwikoMnllHsr3XFfAY1EzPkN
, 7NTzuQfnaNU2Jr4cVgOt7jfTVGq
, 5peSrvUfpp4iLjKNiyPKed3JRXl
, JJbYU8kXU5vwjG80abdAMjC9ndT
, a6LJxbv3VdqA93FD7WYJJvyH6DT
, a3S4R6KZJXp65Gyj1B6hlqULi5X
, 4xCOoqZGrHiTcKl4pZLO4R1K6yk
, I9y3N4mHB0WdHBUQY47VBfns8LQ
, E9KHL90AT90QX6LC9QBKf3MBJwt
, ClOS8VungrQ75v597EdBiDcWL3S
, UYUZnZApb2mKB3E6j4exfiXsjil
, K6CXnUseeoGD9bCKeFgXf3BunqT
, LphoROWxndaFJW8jgSx7PcNujSd
, 3uJquMW9frXbaPRtV7ORqwzhtnz
, 3dcbnaN1fJQGaDBx5iurxyMl93v
, CYH94awhSYETnpoVYb1aNzSJZj9
, 421a7welTNAHhEMWl7hU7fbAs9N
, 54LlKR76UyVexlSzycgbcqP5E9U
, 8Wn2ke2IlBUSKbGNiLx4IAvz9SM
, 6GRp2ms2E19YRK3xpEJbMnMYC0y
, use that as the since_token
parameter to get the next set of 20 starting after that gateway.
URL parameters
Name | Description |
---|---|
since_token | The token of the item to start from (e.g., the last token received in the previous page if iterating through records) |