Getting Started
Pagination
The InChurch API uses cursor-based pagination for efficient navigation through large datasets. This guide explains how pagination works and provides best practices for implementing it in your applications.
Pagination Overview
All list endpoints in the InChurch API support pagination to:
- Improve Performance: Reduce response times and memory usage
- Reduce Bandwidth: Transfer only the data you need
- Prevent Timeouts: Avoid request timeouts on large datasets
- Enable Streaming: Process data in manageable chunks
Pagination Parameters
Request Parameters
| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
limit | integer | 20 | 100 | Number of items per page |
offset | integer | 0 | - | Number of items to skip |
Example Request
Code
This request returns 50 people starting from the 101st person (skipping the first 100).
Response Format
Paginated Response Structure
All paginated responses include both data and metadata:
Code
Metadata Fields
| Field | Description |
|---|---|
total | Total number of items across all pages |
per_page | Number of items requested per page |
current_page | Current page number (1-based) |
last_page | Total number of pages |
from | Index of first item on current page (1-based) |
to | Index of last item on current page (1-based) |
Best Practices
1. Use Appropriate Page Sizes
| Use Case | Recommended Size | Reason |
|---|---|---|
| UI Lists | 20-50 | Good balance of performance and UX |
| Data Export | 100 | Minimize API calls |
| Real-time Processing | 20-30 | Quick response times |
| Background Jobs | 50-100 | Efficient batch processing |
| Mobile Apps | 10-20 | Reduce bandwidth usage |
2. Handle Empty Results
Code
3. Implement Progress Indicators
Code
4. Combine with Filtering
Code
Last modified on