All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.
| Method | HTTP request | Description |
|---|---|---|
| createAccountCronJobV1() | POST /api/hosting/v1/accounts/{username}/cron-jobs | Create account cron job |
| deleteAccountCronJobV1() | DELETE /api/hosting/v1/accounts/{username}/cron-jobs/{uid} | Delete account cron job |
| getCronJobOutputV1() | GET /api/hosting/v1/accounts/{username}/cron-jobs/{uid}/output | Get cron job output |
| listAccountCronJobsV1() | GET /api/hosting/v1/accounts/{username}/cron-jobs | List account cron jobs |
createAccountCronJobV1($username, $hostingV1CronJobsCreateCronJobRequest): \Hostinger\Model\HostingV1CronJobsCronJobResourceCreate account cron job
Creates a cron job for the specified account from a schedule expression and a command. Returns the created cron job, including its uid, which is required to delete the cron job or fetch its output.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config);
$username = u123456789; // string
$hostingV1CronJobsCreateCronJobRequest = new \Hostinger\Model\HostingV1CronJobsCreateCronJobRequest(); // \Hostinger\Model\HostingV1CronJobsCreateCronJobRequest
try {
$result = $apiInstance->createAccountCronJobV1($username, $hostingV1CronJobsCreateCronJobRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingCronJobsApi->createAccountCronJobV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| hostingV1CronJobsCreateCronJobRequest | \Hostinger\Model\HostingV1CronJobsCreateCronJobRequest |
\Hostinger\Model\HostingV1CronJobsCronJobResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
deleteAccountCronJobV1($username, $uid): \Hostinger\Model\CommonSuccessEmptyResourceDelete account cron job
Permanently deletes the cron job identified by its uid. The uid is returned by the list cron jobs endpoint.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config);
$username = u123456789; // string
$uid = cron_abc123; // string | Unique identifier of the cron job as returned by the list cron jobs endpoint.
try {
$result = $apiInstance->deleteAccountCronJobV1($username, $uid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingCronJobsApi->deleteAccountCronJobV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| uid | string | Unique identifier of the cron job as returned by the list cron jobs endpoint. |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getCronJobOutputV1($username, $uid): \Hostinger\Model\HostingV1CronJobsCronJobOutputResourceGet cron job output
Returns the output captured from the last execution of the cron job identified by its uid. The uid is returned by the list cron jobs endpoint.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config);
$username = u123456789; // string
$uid = cron_abc123; // string | Unique identifier of the cron job as returned by the list cron jobs endpoint.
try {
$result = $apiInstance->getCronJobOutputV1($username, $uid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingCronJobsApi->getCronJobOutputV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| uid | string | Unique identifier of the cron job as returned by the list cron jobs endpoint. |
\Hostinger\Model\HostingV1CronJobsCronJobOutputResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
listAccountCronJobsV1($username): \Hostinger\Model\HostingV1CronJobsCronJobResource[]List account cron jobs
Returns the list of cron jobs configured for the specified account, including their schedule and command.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config);
$username = u123456789; // string
try {
$result = $apiInstance->listAccountCronJobsV1($username);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingCronJobsApi->listAccountCronJobsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string |
\Hostinger\Model\HostingV1CronJobsCronJobResource[]
[Back to top] [Back to API list] [Back to Model list] [Back to README]