Skip to main content
Version: 1.2.0-beta

Cron API

Cron jobs can be fully managed through the API and SDK. The section contains methods to execute CRUD-operations against the Cron endpoints.

List#

Returns all cronjobs for selected environment, which is controlled by which API token that is in use.
View in API Docs

$response = $client->cron->list();if ($response->wasSuccessful()) {    $items = $response->getResultItems();    // Do something with items}

Create#

Create a cronjob. Note that you need to specify the environment.
View in API Docs

Example:

$environmentId = 123;$response = $client->cron->create([    'attributes' => [        'enabled' => 1,        'command' => 'ls ./',        'comment' => 'This is a cron job created using the PHP SDK',        'schedule' => '* * * * *',        'notifications' => 'none',    ]], $environmentId);if ($response->wasSuccessful()) {    // Do something} elseif ($response->hasErrors()) {    $errors = $response->getErrors();    // Do something with errors}

Get#

Returns a specific cronjob by ID.
View in API Docs

$response = $client->cron->get(123);if (    $response->wasSuccessful()     && $item = $response->getFirstResultItem()) {    // Do something    echo $item->id; // 123}

Delete#

Deletes a cronjob by ID.
View in API Docs

$response = $client->cron->delete(123);if ($response->wasSuccessful()) {    // Cronjob deleted}

Update#

Updated a cronjob by ID.
View in API Docs

$response = $client->cron->update(123, [    'attributes' => [        'comment' => 'Updated comment'    ]]);if ($response->wasSuccessful()) {    // Cronjob updated}