Create a new cron job
POST
/api/v3/organizations/{organisation}/applications/{application}/environments/{environment}/cron
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/test-org/applications/test-app/environments/test-env/cron';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","description":"example","scheduleExpression":"example","command":["example"],"targetContainerName":"example","isEnabled":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.quantcdn.io/api/v3/organizations/test-org/applications/test-app/environments/test-env/cron \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "description": "example", "scheduleExpression": "example", "command": [ "example" ], "targetContainerName": "example", "isEnabled": true }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”organisation
required
string
The organisation ID
Example
test-orgapplication
required
string
The application ID
Example
test-appenvironment
required
string
The environment ID
Example
test-envRequest Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
string
description
string
scheduleExpression
required
string
command
required
Array<string>
targetContainerName
string
isEnabled
boolean
Responses
Section titled “Responses”The created cron job
Media typeapplication/json
object
name
string
description
string
scheduleExpression
string
command
Array<string>
targetContainerName
string
isEnabled
boolean
lastRun
The newest run of the job. Null when the job has never run. Sent by the cron list.
object
runId
string
status
FAILED_TO_START: the task could not be launched, so the command never ran (for example, the job targets a container that no longer exists).
string
createdAt
string format: date-time
exitCode
integer
errorMessage
Why the run failed, in plain text. Set when the status is FAILED_TO_START.
string
consecutiveFailures
Failed runs (FAILED or FAILED_TO_START) from the newest run back to the first run that did not fail, counted over the latest 10 runs. 0 when the newest run did not fail. Sent by the cron list.
integer
Example
{ "lastRun": { "status": "PENDING" }, "consecutiveFailures": 0}The request is invalid
The request is invalid
Media typeapplication/json
object
message
string
errors
object
Examplegenerated
{ "message": "example", "errors": {}}