Watch a run, resuming from the last event seen
const url = 'https://api.katara.com/katara/v1/orgs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/environments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/runs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/events';const options = {method: 'GET', headers: {cookie: 'katara_session=<katara_session>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.katara.com/katara/v1/orgs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/environments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/runs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/events \ --cookie katara_session=<katara_session>Requires current synapse:runs:read permission. The event id is the run’s own advance counter, never a timestamp, so a reconnecting client resumes exactly and two changes in the same millisecond stay two events. Authority is rechecked on every page, so access removed while a stream is open ends it. A finished run ends the stream rather than holding the connection open, and a stream that has run long enough ends on its own; a client reconnects with the last id it saw and loses nothing. Old events are dropped once a run has finished, keeping what happened to it; resuming from a sequence that was dropped answers 410 rather than skipping to whatever still exists.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”The sequence of the last event the caller already holds. A browser EventSource sends this on its own when it reconnects.
Query Parameters
Section titled “Query Parameters”The same resumption point for a client that keeps its own position. Zero, or absent, means the caller holds nothing yet and is given what is still kept.
Responses
Section titled “Responses”Events after the resumption point. With an Accept of text/event-stream the same events arrive as server-sent events whose id is the sequence; otherwise they come back as one page.
Events after a sequence the reader already holds, with the earliest sequence still kept. A reader resuming from below that point is told the events are gone rather than handed the next thing that still exists.
object
object
One advance of a run, numbered by the run’s own counter. The number is the resumption point, so it is a sequence and never a moment: two changes in the same millisecond are two events.
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Example
{ "key": { "mode": "test", "usage": "simulation" }, "data": [ { "status": "queued", "snapshot": { "key": { "mode": "test", "usage": "simulation" }, "status": "running", "reason": "completed", "wait_kind": "approval", "last": { "key": { "mode": "test", "usage": "simulation" }, "outcome": "succeeded", "output": { "media_type": "text/plain" } }, "output": { "media_type": "text/plain" }, "pending_child": { "key": { "mode": "test", "usage": "simulation" }, "action": "spawn", "request": { "input_ref": { "media_type": "application/json" } } }, "last_child": { "key": { "mode": "test", "usage": "simulation" }, "child": { "mode": "test", "usage": "simulation" }, "state": "queued", "reason": "completed", "output": { "media_type": "text/plain" } } } } ]}default
Section titled “default”Request rejected or unavailable. A resumption point whose events are no longer held answers 410 with stream_gone.
object
object
Stable; branch on it. Any operation can answer invalid_request, with param naming the refused field when there is one; human_session_required, when an API key, service account or workload calls an operation only a signed-in person may perform; reauthentication_required, when a person’s sign-in is too old for the operation; permission_denied; route_not_found and method_not_allowed, when no operation matches the path or method; and feature_unavailable, when the operation’s service is not enabled on this deployment.
The request field a refusal is about, such as the agent_id or run_id query parameter; null when the refusal is not about one field.
Example
{ "error": { "action": "sign_in" }}