The responses from some API endpoints are paginated to reduce the amount of data transferred.
You can control the pagination by providing page
and per_page
integer parameters. For example:
$ curl -s 'https://typekit.com/api/v1/json/libraries/full?page=1&per_page=2' | jsonpretty
{
"library": {
"id": "full",
"link": "/api/v1/json/libraries/full",
"name": "Full Library",
"families": [
{
"id": "nmpn",
"link": "/api/v1/json/families/nmpn",
"name": "Abagail"
},
{
"id": "dltb",
"link": "/api/v1/json/families/dltb",
"name": "Adage Script"
}
],
"pagination": {
"count": 485,
"on": "families"
"page": 1,
"page_count": 243,
"per_page": 2
}
}
}
The list of families in this library has been paginated. The pagination attribute gives more information:
count
is the total number of objects found (in this case, the number of families in this library)on
is the collection that has been paginatedpage
is the number of the current pagepage_count
is the total number of pagesper_page
is the number of objects on each page
Pagination parameters are limited - if you request a page that is too high or too many objects per page you will get a 400
error.