CompuDime API docs

Paging and cursors

Every list answers one page at a time. Follow nextCursor until it is empty.

limit, cursor and nextCursor

cursor=""
while :; do
  page=$(curl -s "https://api.compudime.com/v1/products?limit=500&cursor=$cursor" \
    -H "Authorization: Bearer $PUBLIC_API_KEY")
  echo "$page" | jq -c '.products[]'
  cursor=$(echo "$page" | jq -r '.nextCursor // empty | @uri')
  [ -z "$cursor" ] && break
done
// JavaScript
let cursor = "";
do {
  const url = new URL("https://api.compudime.com/v1/products");
  url.searchParams.set("limit", "500");
  if (cursor) url.searchParams.set("cursor", cursor);
  const response = await fetch(url, { headers: { Authorization: "Bearer " + process.env.PUBLIC_API_KEY } });
  const page = await response.json();
  if (!response.ok) throw new Error(page.code + " (" + page.requestId + "): " + page.detail);
  for (const product of page.products) handle(product);
  cursor = page.nextCursor || "";
} while (cursor);

Long answers

Products and sales movement come from CompuDime's own copy of the store's data. The other lists are read live from the store's POS, a few hundred rows at a time. A larger limit is read in several reads, one after another, and answered at once.

Date ranges

Date ranges (from and to, as YYYY-MM-DD) have no maximum span. The daily sales and sales movement lists answer from the days CompuDime holds; coveredFrom and coveredTo on the answer say which. The ticket list reads a long range from the store a month at a time, so a page may be short or empty while nextCursor is set.

Sync only what changed

Lists that take modifiedSince return only the rows changed at or after that time, plus every row with no change time (it cannot be shown unchanged, so it is always sent). Rows are keyed, so reading one again is harmless.

Paged endpoints