Jobs
Overview
The Jobs endpoint can be used to monitor long running tasks, such as syncing, previewing, or publishing a site.
Listen to a job
This endpoint uses Server Sent Events (SSE) to communicate with the client. Events are streamed in real time, with event data encoded as JSON. When the job completes or fails the server will close the connection. The last event is available for 30 minutes, after which the Job ID expires.
Current Job IDs can be retrieved from the Site endpoint.
Endpoint
GET https://api.siteleaf.com/v2/jobs/:job_id
Response
Status: 200 OK
Content-Type: text/event-stream
event:status
data:{"status":"working","message":"Working...","updated_at":"1452890740"}
event:status
data:{"status":"working","message":"Working...","updated_at":"1452890744"}
event:status
data:{"status":"complete","message":"Done!","updated_at":"1452890745"}
Response after job expires
Status: 410 Gone
Content-Type: text/event-stream
event:status
data:{"status":"error","message":"Job not found"}
Cancel a job
Active jobs can be aborted using the following request.
Endpoint
DELETE https://api.siteleaf.com/v2/jobs/:job_id
Response
Status: 200 OK