REST API
API Pagination
Efficiently retrieve large datasets with cursor-based pagination.
Overview
List endpoints return paginated results to ensure optimal performance. The Infodeck API uses cursor-based pagination with limit and lastEvaluatedKey parameters.
Request Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Number of items per page (max: 100) |
lastEvaluatedKey | string | — | Cursor for the next page (from previous response) |
Response Structure
{
"data": [...],
"lastEvaluatedKey": "eyJpZCI6ImEtMTIzNDU2In0="
}
| Field | Description |
|---|---|
data | Array of items for the current page |
lastEvaluatedKey | Cursor to fetch the next page. null or absent when no more pages exist. |
Example: Fetching All Work Orders
First Request
curl "https://app.infodeck.io/api/organizations/{orgId}/work-orders?limit=50" \
-H "X-API-Key: idt_live_your_api_key_here"
const API_KEY = 'idt_live_your_api_key_here';
const ORG_ID = 'your-organization-id';
const response = await fetch(
`https://app.infodeck.io/api/organizations/${ORG_ID}/work-orders?limit=50`,
{
headers: { 'X-API-Key': API_KEY }
}
);
const { data, lastEvaluatedKey } = await response.json();
import requests
API_KEY = 'idt_live_your_api_key_here'
ORG_ID = 'your-organization-id'
response = requests.get(
f'https://app.infodeck.io/api/organizations/{ORG_ID}/work-orders',
params={'limit': 50},
headers={'X-API-Key': API_KEY}
)
result = response.json()
data = result['data']
last_key = result.get('lastEvaluatedKey')
Subsequent Requests
Pass the lastEvaluatedKey from the previous response to get the next page:
curl "https://app.infodeck.io/api/organizations/{orgId}/work-orders?limit=50&lastEvaluatedKey=eyJpZCI6ImEtMTIzNDU2In0=" \
-H "X-API-Key: idt_live_your_api_key_here"
// Continue fetching until no more pages
let cursor = lastEvaluatedKey;
while (cursor) {
const nextResponse = await fetch(
`https://app.infodeck.io/api/organizations/${ORG_ID}/work-orders?limit=50&lastEvaluatedKey=${encodeURIComponent(cursor)}`,
{
headers: { 'X-API-Key': API_KEY }
}
);
const result = await nextResponse.json();
data.push(...result.data);
cursor = result.lastEvaluatedKey;
}
# Fetch all pages
all_data = data.copy()
while last_key:
response = requests.get(
f'https://app.infodeck.io/api/organizations/{ORG_ID}/work-orders',
params={'limit': 50, 'lastEvaluatedKey': last_key},
headers={'X-API-Key': API_KEY}
)
result = response.json()
all_data.extend(result['data'])
last_key = result.get('lastEvaluatedKey')
Best Practices
- Use reasonable page sizes — Start with
limit=50for most use cases - Don't store cursors long-term — Cursors may expire; use them immediately
- Handle empty pages — A response with empty
dataand nolastEvaluatedKeymeans you've reached the end - Implement retry logic — Network issues can interrupt pagination; track your position
Endpoints Supporting Pagination
Most list endpoints support pagination:
GET /organizations/{orgId}/work-ordersGET /organizations/{orgId}/assetsGET /organizations/{orgId}/locationsGET /organizations/{orgId}/formsGET /organizations/{orgId}/decksGET /organizations/{orgId}/api-keys
Need help? Contact Support
Was this page helpful?