Limit and Skip parameters can be used to control the number of results returned and to skip a certain number of results, respectively.
limit (optional)
The limit
parameter allows you to control the maximum number of items returned in a single paginated request. It determines the page size, helping you manage the amount of data retrieved. By setting a limit, you can request a specific number of results per page, which is useful for optimizing data transfer and rendering performance.
Usage
limit: An integer value representing the maximum number of items to include in the response.
Acceptable values: A positive integer greater than zero.
Example
To request 20 items per page, you would include limit=20
in your request.
skip (optional)
The skip parameter allows you to skip a specified number of items in the paginated result set. This parameter is useful for navigating to a specific page of results by skipping a certain number of items from the beginning of the dataset.
Usage
skip: An integer value representing the number of items to skip in the result set before returning data.
Default value: 0 (i.e., no items are skipped).
Acceptable values: A non-negative integer.
Example
To retrieve results starting from the 21st item (assuming a page size of 20), you would include skip=20
in your pagination request.
Pagination Flow
Use the
limit
parameter to specify how many items you want per page.Use the
skip
parameter to navigate to a specific page by skipping a certain number of items.Combine
limit
andskip
to paginate through the entire result set systematically.
Note
Be cautious when setting large values for
limit
, as it can result in heavy data transfer and increased response times.Ensure that the
skip
value is within the bounds of your result set to avoid errors.