Line gate for Ernie at the Shunde plant. This page and GET /health need no token.
Every other route needs Authorization: Bearer <token>. The token is on the
server in /etc/eco-mes/env. It is not shown here.
Port 443 uses a Let's Encrypt certificate for this IP. It lasts about six days
and the server renews it. Browsers should show a lock. curl does not need -k.
| Method | Path | Auth | What it does |
|---|---|---|---|
| GET | /health | no | Liveness. {"ok": true} |
| GET | / or /docs | no | This page |
| POST | /v1/flow | yes | May this station scan this serial? |
| POST | /v1/runs | yes | Store one finished run |
| POST | /v1/links | yes | Link critical components |
| GET | /v1/units/{serial}/history | yes | Identity, runs, active links |
| GET | /v1/units/{serial}/children | yes | Active component serials |
The name must start with one of these. Lane names such as Ernie Functional 4 match.
| Prefix | Flow | On a stored run |
|---|---|---|
Ernie Functional |
Always allowed when the serial matches. The first scan creates the unit. | PASSED or FAILED. A later PASSED clears an earlier fail. |
Ernie Linker |
Needs a qualifying functional PASSED. Does not create units. |
Writes links. Does not post a run. |
Ernie Provisioning |
Needs that functional PASSED, every required BOM ref linked,
the console not locked, and no provisioning PASSED newer than
the last deprovisioning PASSED. |
PASSED releases the unit. Packing is not a station in this API. |
Ernie Deprovisioning |
Allowed when the unit exists. Stations are not expected to call flow. | PASSED returns the unit to provisioning. Links stay. |
{
"station": "Ernie Functional TLA 1",
"serial": "MC52635A5US010014"
}
A business reject is HTTP 200 with status.code = ERROR. The station shows
status.message as-is. HTTP 401 means the token is missing or wrong.
{
"status": {"code": "OK", "message": ""},
"error": null,
"error_code": null,
"state": "born",
"created": true,
"missing": []
}
curl -k -X POST https://HOST/v1/flow \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"station":"Ernie Functional TLA 1","serial":"MC52635A5US010014"}'
{
"serial": "MC52635A5US010014",
"station": "Ernie Functional TLA 1",
"operator": "1001",
"start_time": "2026-10-26T18:00:00Z",
"end_time": "2026-10-26T18:04:00Z",
"status": "PASSED",
"idempotency_key": "station-run-id",
"test_steps": {
"Test Evaluation": [
{"name": "Check Oscar Secure State 1", "status": "PASSED", "value": 1}
]
}
}
status is PASSED or FAILED. idempotency_key is required.
The same key again returns HTTP 200 with duplicate: true and the same run_id.
test_steps is stored whole. A provisioning run that includes
Check Oscar Secure State 1 with status PASSED locks the console
even when the overall run is FAILED.
An illegal result is HTTP 409 with error REQUEST_REJECTED. Do not retry that body.
A missing or unknown station, a bad timestamp, or a non-object body is HTTP 400.
{
"parent_serial": "MC52635A5US010014",
"operator": "1001",
"components": [
{"ref_designator": "MLB", "component_serial": "C260500001"}
]
}
The unit must already exist and functional must have a qualifying PASSED.
A PCBA serial P YY WW XXXXX with P in CLHS fills the decode columns.
Any other component serial still links, with those columns null. When every required BOM ref is
present, state becomes linked.
curl -k https://HOST/v1/units/MC52635A5US010014/history \ -H "Authorization: Bearer $TOKEN"
History returns identity, runs in ended_at order, and active
links. Unknown serial is HTTP 404. Children returns
{"serial", "components": [{"ref_designator", "component_id"}]}.
On /v1/flow these are HTTP 200 with status.code = ERROR
and error = FLOW_ERROR.
| error_code | message |
|---|---|
INVALID_SERIAL | Serial number does not match the Ernie format. |
UNKNOWN_SERIAL | This serial has not been scanned at functional. |
NO_FUNCTIONAL | Functional has not passed for this serial. |
FUNCTIONAL_FAILED | Latest functional result is FAILED. Run functional again. |
NOT_LINKED | Critical components are not linked. |
MISSING_REFS | Missing components, then the ref names. |
ALREADY_PROVISIONED | This unit is already provisioned. |
CONSOLE_LOCKED | Console is locked. Run deprovisioning before provisioning again. |
COMPONENT_IN_USE | Component serial is already linked to another unit. |
UNKNOWN_STATION | Unknown station. |
Unit, example MC52635A5US010014: company CL|M|A, location SGAEC,
build code 1-9MWR, year, week, product id A5, country, revision, four-digit sequence.
PCBA, example C260500001: C MLB, L button LED, H hall,
S SHT40, then year, week, five-digit sequence.
born, functional_passed, functional_failed, linked,
provisioned, deprovisioned.
Ernie stations are not wired to this service. A failed check here does not stop the line.