AlmondTill/G3N API

abcClasses

query · in the family Reading your records

What it does

ABC inventory classification — ranks the items you sold into A/B/C classes by the value of what they sold. “A” items are your best sellers; “C” items sell the least. The ranking is refreshed every night from the last 30 days of sales.

The ABC ranking: one page of the stored ranking of a location or an organization. The ranking is refreshed every night. It lists the stock positions that sold in the last 30 closed UTC days, best first. The house's cut lines class them by the running share of the scope's total before each position. A position is class A while that share is under 80 %, class B while it is under 95 %, else class C. A scope with no sales in the window is ranked by the value on hand instead (basis: value). A position that is not listed is class C, unless a replenishment config pins it. A pin (abcClassOverride) is applied when the page is read, so an edit shows at once. The counts are the ranking's own, before any pin. While a pin is applied, a listed position refuses VALIDATION/INVALID when two equal-specificity configs set the same parameter for it. The refusal names both configs, as on the planning desks. Scope required bounded: exactly one of logicalFacilityId ⊕ organizationId. limit is 100 by default and 200 at the most — the house's plain page; a larger figure is clamped. A nextToken continues the same ranking and survives ONE refresh. After two refreshes it is refused VALIDATION/INVALID in words: read the ranking again from the start. stored: false means nothing is stored for this scope yet. Requires authentication.

Before you call

A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.

Capability area: Reading your records — Looking up and listing the records of your organization.

Roles that may call it:

What happens

Reads the stored ranking and answers one page of it, best sellers first — ask for the next page to go on. Changes nothing.

Careful

None — a read. An item that is not listed is class C, unless its class was pinned. The ranking is last night’s: today’s sales show after the next refresh.

Arguments

NameTypeRequiredNotes
logicalFacilityIdIDno
organizationIdIDno
limitIntnoHow many records to answer at most; a page may hold fewer.
nextTokenStringnoThe cursor from the previous page, passed back exactly as received.

Returns

AbcClassPage AbcClassPage! — One page of the stored ABC ranking of a location or an organization. When stored is false, nothing is stored for the scope yet: items is empty and every fact below it is null.

This is a page: items holds the records and nextToken the cursor for the next page — pass it back verbatim until it is null. See paging.

Example request

graphql
query ExampleAbcClasses($logicalFacilityId: ID) {
  abcClasses(logicalFacilityId: $logicalFacilityId) {
    items {
      rank
      inventoryItemId
      variantId
      logicalFacilityId
      abcClass
      score
      sharePercent
      overridden
    }
    nextToken
    stored
    windowFromDay
    windowToDay
    madeAt
    basis
    currencies
  }
}

Variables:

json
{
  "logicalFacilityId": "01900000-0000-7000-8000-10c08c590000"
}

Example response

json
{
  "data": {
    "abcClasses": {
      "items": [
        {
          "rank": 1,
          "inventoryItemId": "01900000-0000-7000-8000-ab0d13b80000",
          "variantId": "01900000-0000-7000-8000-8433b0260000",
          "logicalFacilityId": "01900000-0000-7000-8000-10c08c590000",
          "abcClass": "A",
          "score": "<score>",
          "sharePercent": 1.5,
          "overridden": true
        }
      ],
      "nextToken": "<the cursor from the previous page>",
      "stored": true,
      "windowFromDay": "2027-01-31",
      "windowToDay": "2027-01-31",
      "madeAt": "2027-01-31T00:00:00.000Z",
      "basis": "sales",
      "currencies": [
        "<currencies>"
      ]
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer