An Event script reacts inside Camera Server to catalogued application events. An external event subscription only observes them. Reconnecting an observer must never enable a graph or rerun a timeline.
Endpoint reference
No token is needed. The connection access rules apply. Document writes use JSON and Idempotency-Key, but graph CRUD and enable/disable are not protected by the action replay ledger.
| Method and path | Input | Response |
|---|---|---|
GET /scripts/events |
None | {items} summaries and revisions |
POST /scripts/events/validate |
{document} or {text} |
{valid:true,errors:[]} |
POST /scripts/events |
{document} or {text} |
{id,revision} |
GET /scripts/events/{id} |
Document ID | {doc,source,metadata,revision} |
PUT /scripts/events/{id} |
{expectedRevision,document} or {expectedRevision,text} |
{id,revision} |
DELETE /scripts/events/{id} |
{expectedRevision} |
{deleted:true} |
GET /scripts/events/{id}/history |
Document ID | {items} history |
POST /scripts/events/{id}/enabled |
{expectedRevision,enabled} |
{id,enabled,revision} |
GET /scripts/events/{id}/activity |
after, limit, optional type |
Event page plus eventScriptId and current enabled; shared API graph |
Dry validation checks document shape, event fields, public exclusions, and referenced timelines without executing effects. Invalid documents return structured errors, not valid:false. Event JSONC input is parsed but saves normalize content through the event store; comments are not preserved as timeline comments are.
Fetch the current revision after each change. Revision and input errors differ by action:
- Create rejects an existing explicit ID with
409 already_exists. - PUT requires a string revision (
428 revision_requiredif absent); stale revisions give409 revision_conflict. - DELETE and enable/disable use
409 revision_conflictfor missing or stale revisions. - Toggle requires a boolean
enabled(400 invalid_enabled).
API graphs have shared ownership. Any permitted API client can edit, delete, toggle, or inspect their activity, subject to revision and public-policy checks. An unbound graph becomes API-managed through an API save/toggle.
Legacy API graphs are retained and use shared API access, not the former owner's expiry or revocation. Review existing enabled graphs before granting remote access.
Save disabled, enable deliberately
This graph references an existing timeline. Replace saved-timeline-id before validation:
{
"name":"After countdown",
"enabled":false,
"nodes":[
{"id":"source","type":"event","event":"countdown.finished"},
{"id":"target","type":"timeline","timelineScriptId":"saved-timeline-id"}
],
"edges":[
{"id":"start","from":"source","fromPort":"out","to":"target","toPort":"start"}
]
}
Save with {document} or {text}. The service persists a shared API binding before it can enable the graph. A disabled save does not activate it. Creating or replacing with enabled:true is an explicit enable request and checks API entitlement and every graph effect against the public action policy.
Enable separately with the current revision:
{"expectedRevision":"revision-from-event-read","enabled":true}
Use the same endpoint with enabled:false to disable. Turning off remote API access does not disable saved API automation. Disabling still requires API access, entitlement, and the current revision, but does not execute the graph's effects.
Event effects can target timeline, lightColor, lightEffect, and gpio; event and comment nodes do not execute an effect. Referenced timelines and Light/GPIO effects must pass the public action policy. Stop edges may abort matching API-managed work, so coordinate clients before enabling them. Saved lightPreset and sound targets are excluded from public automation.
Current application event catalog
Read GET /scripts/catalog for the installed definitions. Only listed payload fields are forwarded into the public observation stream.
| Event ID | Payload fields |
|---|---|
trigger.started |
groupId, cameraCount, source, zoneName (hidden legacy binding) |
warmup.started |
groupId, zoneName |
countdown.started |
groupId, durationMs, zoneName |
countdown.tick |
groupId, remaining, total, zoneName |
countdown.finished |
groupId, total, durationMs, zoneName |
exposure.started |
requestId, groupId, cameraCount, durationMs, estimated, zoneName |
recording.ending |
requestId, groupId, cameraCount, durationMs, remainingMs, estimated, zoneName (hidden legacy binding) |
exposure.ended |
requestId, groupId, cameraCount, durationMs, remainingMs, estimated, zoneName |
files.transferred |
datasetName, index, frameCount, complete |
processing.finished |
datasetName, requestId, taskCount, lane |
dataset.ready |
datasetName, index, frameCount, complete |
capture.aborted |
groupId, reason, zoneName |
Names/group IDs/source/request IDs are strings; counts, indices, and durations are numbers; complete and estimated are booleans. Fields may be absent when the producer has no value.
files.transferred reports the transfer stage. dataset.ready reports readiness after configured processing has settled for the dataset. Do not treat transfer completion as processed-output readiness. There is no FilesReady alias.
Graph shape and limits
- Edges go from an
eventnode'soutport to an effect node'sstartorstopport. There are no arbitrary target-to-target chains. The shared schema'spauseport is sound-only, so it has no public execution use. - Node and edge IDs are unique within their arrays, 1 through 128 letters, numbers, underscores, or hyphens. Edges must reference existing nodes.
- Enabling requires at least one event-to-target start path. A disabled draft can be incomplete.
- An event node's conditions are ANDed. Each condition is
{field,op,value}using a catalogued field andeq,ne,contains,gt, orlt. Values are strings, numbers, or booleans; strings are at most 256 characters. - Target
paramscan includedelayMs,debounceMs, andcombine:"or"or"and". AND joins collect incoming source matches; OR accepts a matching source. Stops clear pending joins and cancel matching delayed work. - Limits: 256 KiB per document, 128-character name, 64 nodes, 128 edges, 16 conditions per event node, and 600000 ms for delay/debounce. The engine caps event-induced start chain depth at 3.
- Event light effects accept at most 600 frames, framerate 1 through 120, and duration at most 3600000 ms. GPIO event effects use
setorpulse, pins 0 through 27, values 0/1, and pulse duration at most 3600000 ms. Validate the installed node-specific fields before saving.
Single-run exclusion still applies to referenced timelines. Stop handling is limited to API-managed work, but API clients share ownership of that work. Coordinate clients before enabling stop edges.
Future authorization and edits
An enabled graph is still checked before future effects. Its shared API binding, API entitlement, and public action policy are checked on every firing, again after graph delays, and before referenced timeline effects. Referenced timelines are reloaded, so changing a timeline cannot bypass the public action allowlist.
Disabling or changing a graph while delayed work waits cancels its authorization. Lost API entitlement prevents subsequent effects. Already-dispatched node actions may finish; disabling access or automation is not a physical emergency stop.
Graph activity is filtered from retained events to the shared API graph. Follow its returned cursor even when a page has no matching activity: the cursor can advance across unrelated events. Event-triggered target admissions also appear in shared API operation history.