Pagination

In this guide, we will look at how to work with paginated responses when querying the RedirHub API. By default, all responses are limited to 100 results. However, you can customize the number of results returned by passing a per_page parameter to your requests. The per_page should be between 5 and 1,000.

When an API response returns a list of objects, no matter the amount, pagination is supported. In paginated responses, objects are nested in a data attribute and have a meta attribute that provides useful information about the paginated result set. You can use the page query parameter in combination with the per_page to browse additional results from the API.

{
   "data":[
      
   ],
   "meta":{
      "pagination":{
         "total":49,
         "count":49,
         "per_page":100,
         "current_page":1,
         "total_pages":1,
         "links":[
            
         ]
      }
   }
}

Finally, a link field within the response body will conveniently provide you with the next and previous API URLs.

Last updated