Skip to content

Pagination

List endpoints return paginated results. The default page size is 25 items, configurable up to 100.

Query parameters

ParameterTypeDefaultDescription
pageinteger1Page number
per_pageinteger25Items per page (max 100)
GET /v2/resources/blog-posts?page=2&per_page=10

Response 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
  }
}
KeyDescription
firstURL to the first page
lastURL to the last page
prevURL to the previous page (null on the first page)
nextURL to the next page (null on the last page)

meta

KeyTypeDescription
current_pageintegerThe current page number
last_pageintegerThe last available page
per_pageintegerItems per page
totalintegerTotal 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.

Diggama Documentation