Skip to main content

API Reference

This service publishes three machine-readable contracts, all linted in CI by Spectral on every push and pull request:

ContractFileRendered here
REST (OLTP, cmd/wes) — OpenAPI 3.0.3apis/openapi.yamlREST API — generated from the spec, not hand-transcribed
Reports REST (cmd/wes-reports) — OpenAPI 3.0.3apis/openapi-reports.yamlReports API — generated from the spec (ADR-0038)
Events — AsyncAPI 2.6.0apis/asyncapi.yamlEvents

The reports binary is a separate process on a separate port (:8092) against the analytical database, so its three routes (GET /reports/throughput, GET /reports/throughput/freshness, GET /healthz) have their own spec. internal/adapters/inbound/http/reports_contract_test.go fails when the reports router and that spec disagree on a route or a response shape.

Endpoint coverage: 14 operations​

Every route registered in internal/adapters/inbound/http/router.go is documented in apis/openapi.yaml, and therefore appears in the generated reference — including GET /readyz, the readiness probe that flips to not-ready first on graceful shutdown (ADR-0023).

#MethodPathUse caseOpenAPI operationId
1POST/paths/{pathId}/charge— (removed in ADR-0049 stage E after one release of 410 charge-forecast-moved; answers 404, ADR-0049)—
2POST/paths/{pathId}/plan— (removed in ADR-0049 stage E after one release of 410 shift-plan-moved; answers 404)—
3POST/paths/{pathId}/work-unitsEnqueueWorkUnitenqueueWorkUnit
4POST/paths/{pathId}/work-releasesReleaseNextWorkreleaseNextWork
5POST/work-units/{id}/completionsRecordCompletionrecordCompletion
6GET/paths/{pathId}/telemetrySampleBacklogsampleBacklog
7POST/paths/{pathId}/rebalance-decisionsRebalanceDecisionrebalanceDecision
8GET/paths/{pathId}/labor-plan-viewLaborPlanView (projection)getLaborPlanView
9GET/inventory-view/{sku}InventoryView (projection)getInventoryView
10GET/work-units?reference=GetWorkUnitsByReferencegetWorkUnitsByReference
11GET/work-units/{id}GetWorkUnitgetWorkUnit
12GET/healthz—healthCheck
13GET/readyz—readinessCheck
14PUT/paths/{pathId}/poolConfigurePool (ADR-0034)configurePool

Design constraints​

  • Richardson Maturity Level 2, deliberately. Resource nouns, correct verbs, correct status codes — and no hypermedia controls. Level 3 was not attempted; saying so in the spec's own description is more useful than leaving readers to infer it.
  • All errors are RFC 7807 application/problem+json. See Error model.
  • Domain structs never leak. Every request and response is a DTO defined in the HTTP adapter (dto.go). Field names are camelCase on the wire; timestamps are RFC 3339.
  • POST /paths/{pathId}/work-releases is a POST on a sub-resource, not GET .../next, because releasing mutates the pool: an entry transitions to Released and can never be handed out again.

Two POSTs that are not creations​

/paths/{pathId}/work-releases and /work-units/{id}/completions are transition resources (ADR-0047): POST because they are state transitions, not because they create a resource. Like every POST they are idempotent through Idempotency-Key. Both return the affected representation with 200, not 201 — there is no new URI to point a Location header at.

The creation endpoint (/work-units) does return 201 with a Location header. The two moved planning routes answered 410 for one release and were removed in stage E (ADR-0049).