The Pagination API provides functionality to fetch data in a paginated manner, which helps in managing large datasets efficiently.

Usage

To use the Pagination API, you need to make a GET request to the endpoint /api/v1/pagination.

Query Parameters

  • page: The page number to fetch data from. Defaults to 1 if not specified.
  • limit: The number of items to return per page. Defaults to 10 if not specified.

Example Request

GET /api/v1/pagination?page=2&limit=20

Response

The API returns a JSON object with the following fields:

  • data: An array of items for the requested page.
  • total: The total number of items available.
  • pages: The total number of pages available.
  • current_page: The current page number.
  • per_page: The number of items per page.

Example Response

{
  "data": [
    {
      "id": 1,
      "name": "Item 1",
      "description": "This is the first item."
    },
    {
      "id": 2,
      "name": "Item 2",
      "description": "This is the second item."
    }
  ],
  "total": 100,
  "pages": 10,
  "current_page": 2,
  "per_page": 20
}

More Information

For more information about the Pagination API, please refer to the Developer Documentation.

Pagination Example