Cameras and edge nodes
See Cameras and edge nodes for how cameras, edge nodes and assignment work.
Reading endpoints work for operators and admins. Endpoints that change cameras need the admin role.
The camera object
idintegeroptionalnamestringoptionalsource_uristringoptional***.organization_idintegeroptionalorganization_namestringoptionaldetection_profilestringoptionalzone_configobjectoptional{"zone name": polygon}.enabledbooleanoptionalassigned_node_idinteger or nulloptionalnull if unassigned.last_frame_atstring or nulloptionallive_urlstring or nulloptionalnull when the camera is unassigned or its edge node is offline. Tokens last 5 minutes; list the cameras again for a fresh one.created_atstringoptionalList cameras
Add a camera
/camerasAdds a camera. If you assign it to an edge node, that node starts processing it within about 10 seconds. Requires the admin role.
Body
namestringrequiredsource_uristringrequiredrtsp://192.168.1.100:554/stream.organization_idintegerrequiredGET /organizations.detection_profilestringoptionaldefault profile.assigned_node_idinteger or nulloptionalnull to save the camera unassigned.Responses
Change a camera
/cameras/{camera_id}Changes one or more fields. Send only the fields you want to change. Requires the admin role.
Path parameters
camera_idintegerrequiredBody
namestringoptionalsource_uristringoptionalorganization_idintegeroptionaldetection_profilestringoptionalenabledbooleanoptionalfalse stops processing and keeps the camera's history.Responses
Assign a camera to an edge node
/cameras/{camera_id}/assignMoves a camera to an edge node, or unassigns it. Requires the admin role.
Path parameters
camera_idintegerrequiredBody
assigned_node_idinteger or nullrequiredGET /edge-nodes, or null to unassign the camera.Responses
Delete a camera
/cameras/{camera_id}Deletes a camera that has no history, and its zones. A camera with detections or events can't be deleted. Disable it instead. Requires the admin role.
Path parameters
camera_idintegerrequiredResponses
{"status": "deleted"}.Test a stream
/cameras/test-connectionOpens a stream, reads one frame and returns it as a JPEG data URL. Use it to check a URL and its credentials before you save a camera. The site node opens the stream, so it must be able to reach the camera. Requires the admin role.
Accepted sources are rtsp://, rtsps://, http:// and https:// URLs. Addresses on the site node itself (loopback), link-local addresses and cloud metadata addresses are refused. Private network addresses, where cameras usually live, are allowed.
Body
source_uristringrequiredResponse fields
snapshotstringoptionaldata:image/jpeg;base64,... URL.Responses
Get a snapshot
Stream a camera
/cameras/{camera_id}/streamStreams a saved camera as MJPEG (multipart/x-mixed-replace), at up to 10 frames a second, through the site node. The dashboard's single-camera view uses it. Each open stream makes the site node open its own connection to the camera. The Live Wall uses each camera's live_url instead, which is served by the edge node.
Path parameters
camera_idintegerrequiredResponses
Zones
A zone is a named area of a camera's picture, such as "Loading dock". Workflow conditions refer to a zone by its name. See Zones.
Polygon points are [x, y] pairs given as fractions of the picture's width and height, from 0 to 1. [0, 0] is the top-left corner and [1, 1] the bottom-right, so zones stay correct if the camera's resolution changes.
Listing zones works for operators and admins. Adding and deleting zones needs the admin role. Zone changes reach the rule engine within about 10 seconds.
/cameras/{camera_id}/zonesLists a camera's zones, each with id, camera_id, name, polygon and created_at.
/cameras/{camera_id}/zonesAdds a zone to a camera.
Body
namestringrequiredpolygonarrayrequired[x, y] points, each coordinate from 0 to 1./zones/{zone_id}Deletes a zone. Workflows that name it stop matching on that camera.
Responses
id.0 to 1.Organizations
Organizations group cameras, for example by building or tenant. Every site starts with one, Default Organization. Listing works for operators and admins; the other endpoints need the admin role.
/organizationsLists organizations with id, name, description, camera_count, created_at and updated_at. GET /organizations/{org_id} returns one.
/organizationsAdds an organization. Body: name (required, unique) and description.
/organizations/{org_id}Changes name or description.
/organizations/{org_id}Deletes an organization that has no cameras. Move or delete its cameras first.
Responses
POST returns 201 with the organization.List edge nodes
/edge-nodesLists the edge nodes that have registered with the site, sorted by name. Each running edge node refreshes last_heartbeat about every 10 seconds. The dashboard shows a node as online when its last heartbeat is less than 30 seconds old.
Response fields
An array of edge nodes:
idintegeroptionalnamestringoptionallast_heartbeatstringoptionalpublic_hoststring or nulloptional/edge/<node name> on the dashboard's own HTTPS address.public_host_overriddenbooleanoptionaltrue when an admin has pinned public_host.Responses
Set an edge node's live view address
/edge-nodes/{node_id}Pins the address browsers use for this node's live view. A pinned address is kept until you clear it; the node's own setting no longer overwrites it. Requires the admin role.
Use a same-origin path such as /edge/edge-2 where you can. An http:// address is blocked by browsers as mixed content on the HTTPS dashboard.
Path parameters
node_idintegerrequiredBody
public_hoststring or nullrequirednull to clear the pin. The node then registers its own address again on its next heartbeat.Responses
public_host is missing or not a valid address.