Skip to main content

Pagination

The page and list parameters allow you to control how many records to fetch and which page to return. This is crucial for handling large datasets efficiently by retrieving them in smaller, manageable chunks.

The following example fetches the first page of 10 users.

TypeScript
const users = await manta.fetchAllRecords({
table: 'users',
fields: ['user_id', 'first_name', 'last_name'],
page: 1,
list: 10
});
TypeScript
// Fetch all records by omitting pagination parameters.
const allUsers = await manta.fetchAllRecords({
table: "users",
fields: ["user_id", "first_name", "last_name"],
orderBy: "first_name",
order: "asc",
// No page or list = fetch all records
});

Pagination metadata

The API response for paginated queries includes a meta object that provides important information about the full dataset, such as the total number of records and the total number of pages.

JSON
{
"meta": {
"page": 1,
"list": 10,
"total": 25,
"totalPages": 3
}
}