Skip to content
Guides

Pagination

Identify and walk the pagination strategy defined by each endpoint.

Ecomiq does not use one pagination strategy. An operation may use cursor, page and pageSize, only limit, or no pagination.

Identify the strategy

Read the endpoint parameters and response schema. Do not send parameters that are absent from its contract.

StrategyCommon parametersHow to continue
Cursorcursor, limitSend the cursor returned by the previous response.
Pagepage, pageSizeIncrease page until you reach the last page.
LimitlimitReturns a subset; it does not imply that a next page exists.
No paginationNoneThe operation returns its bounded collection in one response.

Filters, sorting, ranges, and defaults also vary by endpoint. The presence of limit does not guarantee cursor support.

Cursor traversal

A cursor response may include data, hasNextPage, and nextCursor. Use these fields only when they are part of the published schema.

async function* walkByCursor(firstUrl: URL, token: string) {
  let cursor: string | undefined;

  do {
    const url = new URL(firstUrl);
    if (cursor) url.searchParams.set("cursor", cursor);

    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${token}` },
    });
    if (!response.ok) throw new Error(`HTTP ${response.status}`);

    const page = await response.json();
    yield* page.data;
    cursor = undefined;
    if (page.hasNextPage) {
      cursor = page.nextCursor;
    }
  } while (cursor);
}

The cursor is opaque

Send nextCursor back without parsing, changing, or constructing it. Do not use it with other filters, another store, or a different query.

If the response does not publish hasNextPage, follow the condition documented for that endpoint. Do not infer the end from totalCount when that field may be null.

Page traversal

Storefront includes operations with page and pageSize. Keep the filters fixed and advance the page number according to the response fields.

curl "https://mystore.ecomiq.app/api/v1/products?page=1&pageSize=24"

Do not replace page with a cursor or send pageSize to an operation that only declares limit.

Limit-only queries

An operation with limit may return recent records or a bounded list without a continuation mechanism. If you need more data, find a dedicated paginated operation; repeating the same request does not advance.

Changes during traversal

Keep filters, order, and context unchanged. If they change, start a new traversal.

A collection may change while you traverse it. If you need a snapshot, check whether the endpoint offers a cutoff time, version, or export; pagination alone does not promise that isolation.

On this page