Top products sold
The answer to "what sold most", "top products by revenue", "units per SKU",
in a single call — instead of paging line items and grouping client-side.
Ranks sold items (order_item) by product, SKU, category or brand, in the
same scope as the sales report (org, window in the org timezone, store,
status).
Per row: units (quantity sold), unitsCanceled, revenue, orders (how
many orders included it) and lines. Rows are the top N by revenue
(limit, default 50); the total covers every item in the period, not
just the top.
Break it down by store or time in one call. groupBy takes a comma list:
the first token is the item dimension (product/sku/category/brand) and
you may add store and/or one time grain (day/week/month) — e.g.
groupBy=product,store, sku,week, product,store,month. With a breakdown the
limit picks the top items for the whole period and each row is one cell
(item × store × period), so you get the per-store or weekly split without one
call per store. Each row then carries storeId, day (YYYY-MM-DD), week
(YYYY-Www, ISO) or month (YYYY-MM) as applicable; a cell with no sales is not
emitted.
revenue is line revenue — SUM(price × quantity), where price is the
item's unit price net of the item discount. It is not the order total, and
does not match the sales report's revenue: order-level discounts and
adjustments are not pushed down to the item price, so the sum of the lines runs
higher (≈+20% measured). Use this for product ranking; use
order.report.sales for revenue/billing. Values are in cents.
category and brand come from partial ingestion and are sparse today
(single-digit % on some orgs). The endpoint is ready for them now and fills in
as ingestion improves — read meta.coverage (the fraction of items and revenue
that carry a category/brand) so a breakdown covering 5% of the period is not
mistaken for the whole. Rows with a null id are the items missing that field.
order_item stores no category/brand name, only the id and external refId.
Try-it values populated from environment ACME (Demo)
Authentication
Token
Send your user token in the x-guper-authorization header.