Overview
Pagination is used by the Cevoid API to limit data returned in a single request, making it easier to work with large datasets. All API endpoints that return multiple items support pagination.
limit
- Type: Integer
- Default: 10 items
- Maximum: 25 items
- Description: Controls the number of items returned per request
skip
- Type: Integer
- Default: 0
- Description: Number of items to skip from the beginning of the result set
Making Paginated Requests
curl -G https://api.cevoid.com/v1/posts \
-H "x-api-key: {your-api-key}" \
-d skip=0 \
-d limit=10
curl -G https://api.cevoid.com/v1/posts \
-H "x-api-key: {your-api-key}" \
-d skip=5 \
-d limit=15
Paginated responses include helpful metadata to navigate through the dataset:
{
"count": 30,
"next": "https://api.cevoid.com/v1/posts?skip=15&limit=10",
"nodes": [
{
"id": "WAz8eIbvDR60rouK",
// ... post data
},
{
"id": "XBa9fJcwES71spvL",
// ... post data
}
// ... more items
]
}
Response Fields
count: Total number of items available
next: URL for the next page of results (if available)
nodes: Array containing the requested items
Use the next field from the response to get the URL for the next page of results. This ensures you’re using the correct parameters.
Efficient Navigation
- Start with reasonable limits: Use the default limit of 10 for most use cases
- Use the
next URL: Don’t manually construct pagination URLs
- Handle empty results: Check if
nodes is empty to detect the end of results
- Respect rate limits: Don’t make requests too quickly when paginating through large datasets
Example: Iterating Through All Results
let skip = 0;
const limit = 25; // Use maximum for efficiency
let hasMoreData = true;
while (hasMoreData) {
const response = await fetch(`https://api.cevoid.com/v1/posts?skip=${skip}&limit=${limit}`, {
headers: {
'x-api-key': 'your-api-key'
}
});
const data = await response.json();
// Process the current batch
data.nodes.forEach(post => {
// Handle each post
});
// Check if there are more results
hasMoreData = data.nodes.length === limit;
skip += limit;
}
Remember that the maximum limit is 25 items per request. Requests with a higher limit will be automatically capped at 25.