Table of Contents

API : Tools: Scheduled jobs : List

Introduction

Returns the jobs waiting to run, the one due soonest first. A recurring job additionally carries the next three occurrences in nextRuns, so a schedule can be sanity checked from the list.

Request

URL https://api.telecomx.dk/tools/scheduledjobs
Method GET
Access level Admin

Query example

https://api.telecomx.dk/tools/scheduledjobs

Response

An object with jobs (array of scheduled jobs), total, offset and limit. The list is not paged - it is the working list and is expected to stay small.

Each job:

Field Type Description
_id Id Unique id of the job
name String Human readable label shown in the admin UI. Absent on jobs created before this field existed.
when Date When the job should run. For a recurring job, its next occurrence.
recurrence Object Recurrence settings, see Recurrence. Absent means the job runs once.
what String Type of event. CUSTOM for jobs created from the admin UI, DELETE for employee deletions.
hostname String Hostname to call. “https://” is prefixed when the hostname carries no scheme.
path String Path appended to the hostname.
method String HTTP method: GET, POST, PATCH or DELETE.
params Object Key-value pairs sent as query string parameters.
body Object Request body.
timeoutMs Number Request timeout in milliseconds, default 120000.
accountId Id Account the job relates to. Jobs sharing an account are never run concurrently.
customerId Id Customer the job relates to.
customerName String Name of that customer.
createdBy Object Employee the job runs as: _id and name. Denormalised, because the employee's details may change before the job runs.
createdByEmailAddress String Email address of that employee.
failed Number Consecutive failures. Reset to 0 on success.
error Object Details of the last error: message and stack.
lastRunAt Date When the job was last attempted.
lastStatus Number HTTP status of the last attempt.
lastDurationMs Number Duration of the last attempt.
runCount Number Successful runs since the job was created.
runningSince Date Set while a run is in flight, cleared when it finishes.
createdAt Date When the job was created.
updatedAt Date When the job was last changed.

Plus, for recurring jobs:

Field Type Description
nextRuns Array The next three occurrences, as dates.

Errors

Error code Message Description
403 access_denied Insufficient access level
500 internal_error <Unspecified>