Pagination

Each collection always has a meta and links key with information about the paginator.


Meta

meta contains the complete information of the paginator, such as the current page or the number of results.

Links

links contains the direct URLs for navigating through the result set (first, last, prev and next).

Parameters

By default, 25 objects are returned per page.

You can request a different pagination limit or force pagination by appending ?per_page to the request with the number of items you would like per page. For instance, to show only two results per page, you could add ?per_page=2 to the end of your query. The maximum number of results per page is 100.

You can use the URLs listed under links to browse through the pages or directly select a page using the ?page query string parameter. With ?page=4 you can e. g. go directly to page 4.

Example

{primary.fa-paper-plane} Request

GET /media?per_page=2&page=4 HTTP/1.1

{success} Response

{
     "data": [
         {
             "id": 1005,
             "is_test": true,
             "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
             "size": 42840,
             "mime_type": "image/jpeg",
             "download_url": "https://api.smake.io/v2/media/1005/download",
             "created_at": "2017-09-28T08:40:44+00:00",
             "updated_at": "2017-09-28T08:40:44+00:00"
         },
         {
             "id": 1006,
             "is_test": true,
             "file_name": "5d9de455299a4c369fcf719b677cf4cd.jpeg",
             "size": 42840,
             "mime_type": "image/jpeg",
             "download_url": "https://api.smake.io/v2/media/1006/download",
             "created_at": "2017-09-28T08:46:21+00:00",
             "updated_at": "2017-09-28T08:46:21+00:00"
         }
     ],
     "links": {
         "first": "https://api.smake.io/v2/media?page=1&per_page=2",
         "last": null,
         "prev": "https://api.smake.io/v2/media?page=3&per_page=2",
         "next": "https://api.smake.io/v2/media?page=2&per_page=2"
     },
     "meta": {
         "current_page": 4,
         "from": 1,
         "path": "https://api.smake.io/v2/media",
         "per_page": 2,
         "to": 2,
     }
 }