Get service order statistics per store
Get the service order figures store by store over a period, one row per store. This is what a store comparison is read from, and what a top or bottom list is built out of — the stores that turn work around fastest, the ones sitting on the most open cases, the ones missing the promised date most often. Every period figure means exactly what the figure of the same name means on the service order statistics endpoint, computed the same way from the same event history, over the service orders the store owns — a row is the statistics endpoint's figure narrowed to one store, never a differently defined number. openCount is the row's now-figure: what openByState counts, narrowed to the store. storeUids narrows the comparison to the named stores; left out, every store the caller holds SERVICE_ORDER or REPORTING at with something to show is returned. The period given by fromDate and toDate applies to completedCount, avgQueueDays, avgWorkDays, avgWorkOpenDays, avgPickupDays and overdueRate, which all read the service orders completed within it. openCount is the one figure it does not apply to: it says how many service orders the store has open at the moment of the call, whatever period was asked for. Asking without a period still returns openCount in full. A store gets a row when it owns at least one service order either figure set covers — one completed within the period, or one that is open right now. A store with nothing on either count is not returned; a store with open work and nothing completed in the period is returned with completedCount 0 and avgQueueDays, avgWorkDays, avgWorkOpenDays, avgPickupDays and overdueRate null. No ordering is promised. Ranking is the client's to do: sort the rows on whichever figure the list is about, and cut it to the length the panel has room for. The figures key on the store that owns a service order, never on the store it was taken in at: a case that has moved counts for the store it moved to, and for no other. Being able to read a case from another store, the store it was taken in at included, does not make it that store's work here. The figures count only the service orders owned by the stores the caller holds SERVICE_ORDER or REPORTING at — every store of the tenant for a tenant-wide holder, the organization's stores for an organization holder, the assigned stores for a store-level holder, the two permissions adding up — because a figure is a store's work, not a case to find; the tenant-level service order search reaches further, to every service order of the tenant, for a caller holding SERVICE_ORDER. A caller holding REPORTING and not SERVICE_ORDER is answered exactly as a caller holding SERVICE_ORDER at the same stores is. A caller holding neither, a user with no role assignments included, is refused with a 403.
Required permissions: SERVICE_ORDER,REPORTING
Access token recevied after user login with a deviceToken
Reference to a tenant.
^[A-Za-z0-9-_]+The start of the period the figures are measured over (inclusive). The date names a day in the tenant's timezone. It applies to the period figures, and each endpoint states which of its figures those are. The figures that count open service orders always describe how things stand right now, whatever period was asked for. The period is not capped. Every figure is computed live from the event history on each request, over whatever period is asked for, so a full year is asked for exactly the way a single week is. ISO 8601 date format: YYYY-MM-DD, e.g. 2026-01-01.
The end of the period the figures are measured over (inclusive). The date names a day in the tenant's timezone. It applies to the period figures, and each endpoint states which of its figures those are. The figures that count open service orders always describe how things stand right now, whatever period was asked for. The period is not capped. Every figure is computed live from the event history on each request, over whatever period is asked for, so a full year is asked for exactly the way a single week is. ISO 8601 date format: YYYY-MM-DD, e.g. 2026-01-31.
Narrow every figure to the stores that own the service orders — the stores the work sits with and where the customers collect. This is the owning store, not the store a service order was taken in at, and the two differ whenever a service order has been moved between stores. Leave it out to get every store the caller holds SERVICE_ORDER or REPORTING at — every store of the tenant for a tenant-wide holder, the organization's stores for an organization holder, the assigned stores for a store-level holder, the two permissions adding up. Naming a store the caller holds neither SERVICE_ORDER nor REPORTING at is not refused and adds nothing: storeUids narrows within the caller's stores and never widens them. A storeUid naming no store of the tenant answers 400.
Example response
GET /v2/tenants/{tenantUid}/serviceorders/stats/stores HTTP/1.1
Host: api.flowretail.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
Example response
{
"items": [
{
"storeUid": "text",
"storeName": "text",
"completedCount": 1,
"avgQueueDays": 1,
"avgWorkDays": 1,
"avgWorkOpenDays": 1,
"avgPickupDays": 1,
"overdueRate": 1,
"openCount": 1
}
]
}Last updated
Was this helpful?

