Pagination

The response from an API call may have multiple pages of data. If the data has multiple pages, the JSON response will have additional details in the `meta` field.

Meta Field Values

total_results: integer
The total items available to be returned.

total_pages: integer
The total pages available to be returned.

page_previous: integer
The page number of the previous set of data (if there is no previous data, this will be set to `1`).

page_next: integer
The page number of the next set of data (if there is no more data available, this will be set to the current page).

page_current: integer
The page number of the current set of data.

current_result: integer
The index of the first item on the current page.

current_result_first: integer
The index of the first item on the current page.

current_result_last: integer
The index of the last item on the current page.

per_page: integer
The number of items returned per page.

url_next: string
The API URL that can be used to call the next page of items (if there is no more data available, this will be set to the current URL).

url_current: string
The API URL that can be used to call the current page of items.

url_previous: string
The API URL that can be used to call the previous page of items (if there is no previous data, this will be set to the current URL).

Response

Below is an example of the format of the pagination data:

{
  "status": "success",
  "messages": [],
  "meta": {
    "pagination": {
      "total_results": 100,
      "total_pages": 5,
      "page_previous": 1,
      "page_next": 2,
      "page_current": 1,
      "current_page": 1,
      "current_result": 1,
      "current_result_first": 1,
      "current_result_last": 20,
      "per_page": 20,
      "url_next": "https://www.piperiv.com/api/v1/example?page=2",
      "url_current": "https://www.piperiv.com/api/v1/example?page=1",
      "url_previous": "https://www.piperiv.com/api/v1/example?page=1"
    }
  },
  "data": [...]
}