Pagination
List endpoints return paginated results. The default page size is 25 items, configurable up to 100.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
per_page | integer | 25 | Items per page (max 100) |
GET /v2/resources/blog-posts?page=2&per_page=10Response structure
Every paginated response includes links and meta objects alongside the data array:
json
{
"data": [ ... ],
"links": {
"first": "https://api.diggama.com/v2/resources/blog-posts?page=1",
"last": "https://api.diggama.com/v2/resources/blog-posts?page=5",
"prev": "https://api.diggama.com/v2/resources/blog-posts?page=1",
"next": "https://api.diggama.com/v2/resources/blog-posts?page=3"
},
"meta": {
"current_page": 2,
"last_page": 5,
"per_page": 10,
"total": 42
}
}links
| Key | Description |
|---|---|
first | URL to the first page |
last | URL to the last page |
prev | URL to the previous page (null on the first page) |
next | URL to the next page (null on the last page) |
meta
| Key | Type | Description |
|---|---|---|
current_page | integer | The current page number |
last_page | integer | The last available page |
per_page | integer | Items per page |
total | integer | Total number of matching resources |
Iterating through all pages
Use meta.last_page or follow links.next until it is null:
javascript
async function fetchAll(blueprint, token) {
let page = 1;
let results = [];
while (true) {
const res = await fetch(
`https://api.diggama.com/v2/resources/${blueprint}?page=${page}&per_page=100`,
{ headers: { 'Authorization': `Bearer ${token}` } }
);
const json = await res.json();
results.push(...json.data);
if (page >= json.meta.last_page) break;
page++;
}
return results;
}If you need all resources in a single request without pagination, use the Export endpoint instead.