Skip to content

Send events

You will post an event that starts a run, repeat it without starting a second run, and send events that reach an open run. The commands assume the variables and the floor function from Run floor and walk your first line.

Field Required Holds
name yes The event’s name. A line starts on the names in its start.on.
payload yes A JSON object. A line’s start templates and a run’s reports read its top-level fields.
dedupeKey no A string. Two events with one key are one event.
availableAt no A time. The event is not available before it.

The line approval starts on doc.submitted and has a human station at its node review. Adapt the line of the first tutorial to it.

Terminal window
floor -X POST $FLOOR_API_URL/events -d '{"name":"doc.submitted","payload":{"doc":"spec-7"},"dedupeKey":"doc.submitted:spec-7"}' | jq -c '{id,name,dedupeKey}'
{"id":"85","name":"doc.submitted","dedupeKey":"doc.submitted:spec-7"}
Terminal window
RUN=$(floor "$FLOOR_API_URL/assembly-runs?line=approval" | jq -r '.items[0].id')

Send the same request again. The answer is the same event, and no second run starts.

{"id":"85","name":"doc.submitted","dedupeKey":"doc.submitted:spec-7"}

A node answers a waiting visit through its reports. This node answers two events, one per outcome.

nodes:
- id: review
station: reviewer
reports:
- on: review.approved
outcome: approved
- on: review.rejected
outcome: rejected

Name the run by its runId in the payload.

Terminal window
floor -X POST $FLOOR_API_URL/events -d "{\"name\":\"review.approved\",\"payload\":{\"runId\":\"$RUN\"}}" | jq -c '{id,name}'
floor $FLOOR_API_URL/assembly-runs/$RUN | jq -c '{outcome: .run.outcome}'
{"id":"106","name":"review.approved"}
{"outcome":"success"}

Or name it by its subjectKey and repo. A run starts with a repo when the payload of its event has one.

Terminal window
floor -X POST $FLOOR_API_URL/events -d '{"name":"doc.submitted","payload":{"doc":"spec-8","repo":"github.com/acme/shop"}}' | jq -c '{id,name}'
floor -X POST $FLOOR_API_URL/events -d '{"name":"review.rejected","payload":{"subjectKey":"doc:spec-8","repo":"github.com/acme/shop"}}' | jq -c '{id,name}'
{"id":"108","name":"doc.submitted"}
{"id":"111","name":"review.rejected"}

The run ends failed. Events for a running run has the rules.

A post without a payload is refused with 400 and a problem JSON.

Terminal window
floor -i -X POST $FLOOR_API_URL/events -d '{"name":"doc.submitted"}' | grep -E '^(HTTP|content-type|\{)'
HTTP/1.1 400 Bad Request
content-type: application/problem+json
{"type":"about:blank","title":"Bad Request","status":400,"detail":"invalid event","errors":["payload: Invalid input: expected record, received undefined"]}

A valid post is accepted even when the line cannot start from it. Read the event to see why.

Terminal window
EVENT=$(floor -X POST $FLOOR_API_URL/events -d '{"name":"doc.submitted","payload":{"title":"x"}}' | jq -r .id)
floor $FLOOR_API_URL/events/$EVENT | jq -c '{deadAt, lastError}'
{"deadAt":"2026-11-23T14:34:28.359Z","lastError":"line \"approval\": a template names {doc}, which is not there to fill it"}

lastError holds the reason and deadAt says floor has given up on the event.