Pagination
Pagination
In a single instance, a query will retrieve only the first 100 items in the response. You can paginate and retrieve the rest of the items in batches using the skip and limit parameters in subsequent requests.
Example:
const query = stack.contentType("contentTypeUid").entry().query();
const pagedResult = await query
.paginate()
.find<BlogPostEntry>();
// OR
const pagedResult = await query
.paginate({ skip: 20, limit: 20 })
.find<BlogPostEntry>();next
The next method retrieves the next set of response values and skips the current number of responses.
Example:
const pagedResult = await query
.paginate()
.find<BlogPostEntry>();
const nextPageResult = await query.next().find<BlogPostEntry>();previous
The previous method retrieves the previous set of response values and skips the current number of responses.
Example:
const pagedResult = await query
.paginate()
.find<BlogPostEntry>();
const prevPageResult = await query
.previous()
.find<BlogPostEntry>();