REST API
Realtime
Receive live execution updates over a Phoenix Channels websocket.
The dashboard gets live execution updates from a
Phoenix Channels websocket. You can
subscribe from your own browser app with the phoenix npm package.
Connect
- URL:
wss://<api host>/socket(the transport path is/socket/websocket). - Authentication: a login token (from
/signin). Personal API keys and project keys are refused. - Browsers can only connect from the dashboard's origin.
import { Socket } from 'phoenix';
const socket = new Socket('wss://aperture-server.mountaindev.com/socket', {
authToken: loginJwt,
});
socket.connect();Subscribe to a job
Join job_execution:<job_id>. Any member of the job's team can join; others get
{"reason": "unauthorized"}. The channel only sends; it ignores messages from
the client.
const channel = socket.channel(`job_execution:${jobId}`);
channel.on('scheduled', (execution) => console.log('new run', execution));
channel.on('updated', (change) => console.log('run changed', change));
channel.join();Events
| Event | Payload | When |
|---|---|---|
scheduled | id, status: "scheduled", scheduled_time, log_url: null, duration: null, inserted_at, updated_at | A run is created. |
updated | id, name, status: "running" | A run starts. |
updated | id, name, status: "success" | "fail", error_code, log_url, duration | A run finishes. |
updated | id, status: "cancelled" | A run is cancelled. |
updated | id, name, status: "missed" | A cron run was missed. |
updated | id, name, status: "fail", error_code: "orphaned" | A run was orphaned. |
updated payloads are partial: merge them into the execution with the same
id.