A6: Mission Control
It's launch night. Every sleigh leaving the Orimovo workshop needs a mission filed with Mission Control: you open a mission, read its brief, file a load plan, mark it ready and launch it. Mission Control's systems are strict, and so are the people who edit missions alongside you.
Send Authorization: Bearer YOUR_TOKEN with every request (401 without it). Bodies are JSON. Errors are JSON {"error": "...", "detail": "..."}: 400 for a body that isn't the right JSON shape, 422 when it is but its content is wrong, 404 unknown_mission for a mission that doesn't exist, and 409 for a step taken out of turn. On 429, wait Retry-After seconds.
Missions are kept in memory, and only your five latest. If one disappears (404 unknown_mission), start a new one.
1. Open a mission
POST https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions with {"kind": "standard"} returns 201 and the new mission. Its ETag header is the mission's current version:
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" \
-d '{"kind": "standard"}' https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions
HTTP/1.1 201 Created
ETag: "v1"
{"id": "m1-3fa9c2", "kind": "standard", "status": "drafting", "version": 1, "plan": null, "weather": null,
"links": {"self": {"href": "missions/m1-3fa9c2"}, "brief": {"href": "missions/m1-3fa9c2/brief"},
"plan": {"href": "missions/m1-3fa9c2/plan"}, "launch": {"href": "missions/m1-3fa9c2/launch"}}}
kind must be standard or express (422 bad_kind).
GET https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions/:id returns the mission in the same shape, with its current ETag.
2. Read the brief
GET https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions/:id/brief:
{"kind": "standard", "capacity": 120,
"parcels": [
{"id": "p01", "mass": 50, "joy": 30, "fragile": false, "priority": 2},
{"id": "p02", "mass": 60, "joy": 45, "fragile": true, "priority": 1},
{"id": "p03", "mass": 40, "joy": 20, "fragile": false, "priority": 1},
{"id": "p04", "mass": 15, "joy": 10, "fragile": false, "priority": 3}
]}
3. File a plan
A standard mission follows the loading rule: go through the parcels by priority (1 first, ties by id), and load each one that still fits in the remaining capacity. Skip the ones that don't. In the example that's p02 (60), p03 (100 so far), not p01 (would be 150), then p04 (115).
POST https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions/:id/plan with {"parcels": ["p02", "p03", "p04"]} (any order) returns 200 and the mission with "status": "planned". A wrong plan gets 422 with one of unknown_parcel, duplicate_parcel, over_capacity or rule_broken, and the detail says what's wrong. You can file a new plan at any point before launch; it sends the mission back to planned.
4. Mark it ready
PUT https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions/:id with {"status": "ready"} and an If-Match header holding the mission's current ETag, e.g. If-Match: "v3". It returns 200, the mission, and its new ETag.
- No
If-Match:428 precondition_required. - An
If-Matchthat isn't the current ETag:412 stale_etag. Someone else changed the mission; GET it again and decide whether you still want to make your change. - Not planned yet:
409 not_planned. Anystatusother than"ready":422 bad_status.
Ground control edits missions too. When a plan is accepted they attach a weather slot to it, which changes the version again. That's why the plan response carries no ETag: GET the mission to find out its current one.
5. Launch
POST https://outcoded.orimovo.co.uk/api/v1/orbit/A6/missions/:id/launch (no body needed) returns {"launched": true, "launchCode": "..."} once the mission is ready, or 409 not_ready before that.
What is the launch code for a standard mission?