The API is the system's real surface for forecast-modification management; the UI (Ch. 07) and MCP (Ch. 09) are clients of it. Master data has no write surface anywhere (D-23) and only minimal reference reads here. Operations are specified technology-agnostically; the HTTP/JSON notation below is illustrative. Any protocol offering equivalent operations, payloads and error semantics conforms.
GET /masterdata/… (D-23).| Group | Operation (illustrative) | Behaviour / spec refs |
|---|---|---|
| Entries | GET /entries | List; filters = UI-01 columns; pagination; sort |
POST /entries | Create → synchronous disaggregation (HE-06); response = entry incl. state, error_message, LO row count | |
GET /entries/{id} | Entry detail | |
PUT /entries/{id} | Update → synchronous re-disaggregation, atomic replace (DM-12) | |
DELETE /entries/{id} | Hard delete entry + its LO rows (HE Lifecycle) | |
POST /entries/{id}/disaggregate | Manual per-entry re-run | |
| Preview | POST /entries/preview | Dry-run: full entry payload in → would-be disaggregation summary or error out; nothing persisted (UI-05) |
| LO | GET /entries/{id}/lo | The entry's LO rows; paginated |
POST /lo/query | Aggregation query: group-by set (hierarchy level, location, week/month/quarter, entry) + filters → aggregated cells. Powers S3. ≤ 2 s (DF-12). Default excludes stale (HE-09); flag include_stale | |
| Batch | POST /batch/run | Start batch (409 if one is running, DF-09) |
GET /batch/current | Live progress (entries done/total, elapsed) | |
GET /batch/last | Full DF-08 report | |
| Reference | GET /masterdata/… | Read products/hierarchy/attributes (incl. distinct values per attribute name for the UI-04 pickers), locations, customers, calendar. No writes exist (D-23) |
| Admin | POST /admin/reset | Restore seed profile (body: profile id); OV-05 / DE-04 |
POST /admin/regenerate-forecast | Regenerate the synthetic forecast with a new deterministic seed (DE-08); sets all entries RequiresDisaggregation (HE-07) | |
GET /admin/status | Active profile, counts (entries, LO rows), last regeneration & batch timestamps | |
| Export | POST /lo/export | Same body as /lo/query, streams CSV (UI-10) |
| Auth | POST /auth/login | username/password → token (AP-02) |
{"attribute": …, "value": …} of DM-02. State and error_message are
server-assigned and read-only in requests.code, human message, and details[] naming each offending field/key.
Disaggregation failures are not API errors: the operation succeeds and returns the entry in
InError./lo/query responses cap at a documented cell limit and say so explicitly when capped.POST /batch/run returns immediately with a run id; progress
via /batch/current. Exactly one run at a time (DF-09).RequiresDisaggregation (HE-07). Regeneration is rejected (409) while a batch is running./lo/query.POST /entries
{ "title": "B1 spring campaign",
"product_scope": { "attribute": "brand", "value": "B1" },
"location_scope": "ALL", "customer_scope": null,
"period": {"type":"month","id":"M1"}, "value_su": 1000 }
→ 201
{ "entry_id":"e-0042", "state":"Disaggregated", "error_message":null,
"lo_row_count": 13, "value_su": 1000, ... } // matches example E6-A
Equally valid product scopes through the same mechanism:
{"attribute":"upc","value":"U2"} · {"attribute":"product_id","value":"P2"}.