Jobs
Create, read, change, pause, run, and delete a project’s scheduler jobs.
The job object
{
"name": "Nightly report",
"description": "",
"schedule": "0 2 * * *",
"timeZone": "Africa/Dar_es_Salaam",
"target": {
"url": "https://mail.example.com/tasks/report",
"method": "POST",
"headers": { "Content-Type": "application/json" },
"body": "{\"full\":true}"
},
"signing": { "enabled": true, "audience": "" },
"retry": {
"count": 3,
"maxDurationSeconds": 0,
"minBackoffSeconds": 5,
"maxBackoffSeconds": 3600,
"maxDoublings": 5
},
"attemptDeadlineSeconds": 180
}Fields you send
namestring1 to 100 characters, on one line. Unique in the project, ignoring case.
descriptionstringAt most 500 characters. Line breaks are allowed.
schedulestringA 5-field cron schedule, or a shortcut such as
@daily. See Schedules and time zones.timeZonestringAn IANA time zone, such as
Africa/Dar_es_Salaam.UTCwhen empty.target.urlstringAn https URL of at most 2,048 characters, without a user name, password, or
#part.target.methodstringGET,POST,PUT,PATCH,DELETE,HEAD, orOPTIONS.POSTwhen empty.target.headersobjectAt most 50 headers, each set once whatever its case. You cannot set
Host,Content-Length,Transfer-Encoding,Connection,User-Agent, or anyX-Scheduler-header, norAuthorizationwhen signing is on.target.bodystringAt most 100 KB, and only for
POST,PUT, andPATCH.signing.enabledbooleanSign every call. See Verify signed calls.
signing.audiencestringThe token’s
aud. The target URL without its query when empty. A custom audience must use the same scheme and host as the target URL.retryobjectThe retry policy. See Retries.
attemptDeadlineSecondsintegerHow long to wait for an answer, 15 to 1,800 seconds. 180 when you leave it out.
Fields we add
idstringThe job’s ID.
projectIdstringThe project the job belongs to.
statestringenabledorpaused.nextRunAtstring or nullWhen the job runs next.
nullwhile it is paused.lastRunAtstring or nullWhen the job last ran.
signing.effectiveAudiencestringThe audience its tokens carry, after the default is applied.
createdAtstringWhen the job was created.
updatedAtstringWhen the job was last changed.
List jobs
/v1/projects/{project}/jobsReturns the project’s jobs, newest first, a page at a time. See Paging.
Create a job
/v1/projects/{project}/jobsSend the job’s fields. Returns 201 with the new job. A name already used in the project gets 409 with the code job_name_taken.
Read a job
/v1/projects/{project}/jobs/{job}Replace a job
/v1/projects/{project}/jobs/{job}Send every field, as for creating it. Fields you leave out go back to their defaults. The next run time is worked out again from the new schedule.
Delete a job
/v1/projects/{project}/jobs/{job}Deletes the job and all its runs. Returns 204. This cannot be undone.
Pause and resume
/v1/projects/{project}/jobs/{job}/pause/v1/projects/{project}/jobs/{job}/resumeBoth return the job. A paused job is not scheduled, and pausing cancels any scheduled run that is waiting to start or to retry. Resuming schedules the job again from now, so occurrences missed while it was paused do not run.
Run now
/v1/projects/{project}/jobs/{job}/runStarts a run straight away, whatever the schedule, and returns 201 with the run. Its trigger is manual. A job that already has a run in progress gets 409 with the code run_in_progress.
Last updated