Skip to main content

Pagination

Pagination is a technique used to manage large datasets by dividing them into smaller chunks or "pages." Mindsite API utilizes a simple and effective pagination approach that allows you to navigate through results seamlessly.

Page Number and Page Size

Pagination is achieved using two parameters:

  • Current page: The page you want to retrieve. Page numbering starts from 1.
  • Page Size: The number of items to display per page. The minimum page size is 2, and the maximum is 1000.

By specifying the desired page number and page size, you can efficiently retrieve and display the information you need.

Requesting Pages

To retrieve specific pages of data, include the current_page and page_size parameters in your API request. For instance:

GET /api/products?current_page=2&page_size=20

This request would fetch the second page of products, each containing 20 items.

Response Structure

The response for a paginated endpoint includes the following information:

  • Current Page: The current page number.
  • Page Size: The specified page size.
  • Page Count: The total number of pages available based on the page size and total count.
  • Total: The total number of items available across all pages.
  • Items: An array of items representing the current page's data.

Here's an example of a paginated response structure:

{
"current_page": 1,
"page_size": 10,
"page_count": 5,
"total": 47,
"items": [
{ /* Item 1 data */ },
{ /* Item 2 data */ },
/* ... more items ... */
]
}