API Fundamentals
Pagination
LCE query models commonly use zero-based page indexes. Send pageIndex and pageSize in the JSON request body, then use the response counts to decide whether another page is required.
Pagination fields
pageIndexZero-based index of the requested page. The first page is 0, not 1.
pageSizeMaximum number of records requested for a single page.
Response counts
resultCount, totalCount and, where supplied, currentPageIndex.
Request a page
curl --request POST \
--url "$LCE_BASE_URL/metadata/query/languages" \
--header "Authorization: Bearer $LCE_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"tenantId": 1,
"pageIndex": 0,
"pageSize": 50,
"sorting": "FieldName ASC"
}'
Continue until the collection is complete
let pageIndex = 0;
const pageSize = 50;
const records = [];
while (true) {
const response = await queryLanguages({ pageIndex, pageSize });
const page = response.result ?? [];
records.push(...page);
if (page.length === 0) break;
if (
Number.isFinite(response.totalCount) &&
records.length >= response.totalCount
) break;
pageIndex += 1;
}
If totalCount is not populated by the selected operation, stop when the service returns fewer records than pageSize or an empty result.
Pagination practices
- Start with
pageIndex: 0 - Use a moderate page size
- Keep filters constant between pages
- Use stable, supported sorting
- Process each page before requesting the next
- Record progress for resumable exports
- Stop on an empty result
- Protect batch jobs with timeouts