Overview
List endpoints in the Mighty Networks API return paginated results to efficiently handle large datasets. Understanding pagination is essential for building robust integrations that work with all your data.How Pagination Works
When you request a list of resources (members, posts, spaces, etc.), the API returns:- Items - An array of resources for the current page
- Links - URLs for navigating between pages
- Metadata - Information about the pagination state (in some endpoints)
Standard Response Format
Pagination Parameters
Control pagination using query parameters:Example Request
Checking for More Pages
Thelinks object in the response indicates if there are more pages:
links.nextexists - There are more pages availablelinks.nextis null/absent - You’ve reached the last page
Iterating Through All Pages
Basic Pagination Loop
Using the Next Link
Instead of manually incrementing the page number, you can use thenext link:
Advanced Patterns
Paginated Generator Function
For memory efficiency with large datasets:Parallel Pagination
Fetch multiple pages concurrently (use with caution regarding rate limits):Pagination with Progress Tracking
Show progress when fetching large datasets:Python Examples
Basic Pagination
Generator Pattern
Best Practices
- Use Maximum Page Size - Set
per_page=100to minimize API calls - Check for Next Page - Use
links.nextinstead of guessing total pages - Implement Rate Limiting - Add delays between requests to respect rate limits
- Handle Errors - Implement retry logic for failed pagination requests
- Use Generators - For large datasets, use generator patterns to avoid memory issues
- Cache Results - Store paginated results when appropriate to reduce API calls
- Monitor Progress - Implement progress tracking for long-running pagination
- Avoid Parallel Requests - Unless necessary, paginate sequentially to stay within rate limits
Common Pitfalls
❌ Hardcoding Total Pages
✅ Check for Next Link
❌ Ignoring Rate Limits
✅ Add Delays
Next Steps
Rate Limits
Understand API rate limiting.
Error Handling
Handle pagination errors gracefully.
Members
Work with paginated member lists.
Posts
Paginate through posts and content.