|
| 1 | +# Hostinger\HostingCronJobsApi |
| 2 | + |
| 3 | +All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path. |
| 4 | + |
| 5 | +| Method | HTTP request | Description | |
| 6 | +| ------------- | ------------- | ------------- | |
| 7 | +| [**createAccountCronJobV1()**](HostingCronJobsApi.md#createAccountCronJobV1) | **POST** /api/hosting/v1/accounts/{username}/cron-jobs | Create account cron job | |
| 8 | +| [**deleteAccountCronJobV1()**](HostingCronJobsApi.md#deleteAccountCronJobV1) | **DELETE** /api/hosting/v1/accounts/{username}/cron-jobs/{uid} | Delete account cron job | |
| 9 | +| [**getCronJobOutputV1()**](HostingCronJobsApi.md#getCronJobOutputV1) | **GET** /api/hosting/v1/accounts/{username}/cron-jobs/{uid}/output | Get cron job output | |
| 10 | +| [**listAccountCronJobsV1()**](HostingCronJobsApi.md#listAccountCronJobsV1) | **GET** /api/hosting/v1/accounts/{username}/cron-jobs | List account cron jobs | |
| 11 | + |
| 12 | + |
| 13 | +## `createAccountCronJobV1()` |
| 14 | + |
| 15 | +```php |
| 16 | +createAccountCronJobV1($username, $hostingV1CronJobsCreateCronJobRequest): \Hostinger\Model\HostingV1CronJobsCronJobResource |
| 17 | +``` |
| 18 | + |
| 19 | +Create account cron job |
| 20 | + |
| 21 | +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. |
| 22 | + |
| 23 | +### Example |
| 24 | + |
| 25 | +```php |
| 26 | +<?php |
| 27 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 28 | + |
| 29 | + |
| 30 | +// Configure Bearer authorization: apiToken |
| 31 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 32 | + |
| 33 | + |
| 34 | +$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config); |
| 35 | +$username = u123456789; // string |
| 36 | +$hostingV1CronJobsCreateCronJobRequest = new \Hostinger\Model\HostingV1CronJobsCreateCronJobRequest(); // \Hostinger\Model\HostingV1CronJobsCreateCronJobRequest |
| 37 | + |
| 38 | +try { |
| 39 | + $result = $apiInstance->createAccountCronJobV1($username, $hostingV1CronJobsCreateCronJobRequest); |
| 40 | + print_r($result); |
| 41 | +} catch (Exception $e) { |
| 42 | + echo 'Exception when calling HostingCronJobsApi->createAccountCronJobV1: ', $e->getMessage(), PHP_EOL; |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +### Parameters |
| 47 | + |
| 48 | +| Name | Type | Description | Notes | |
| 49 | +| ------------- | ------------- | ------------- | ------------- | |
| 50 | +| **username** | **string**| | | |
| 51 | +| **hostingV1CronJobsCreateCronJobRequest** | [**\Hostinger\Model\HostingV1CronJobsCreateCronJobRequest**](../Model/HostingV1CronJobsCreateCronJobRequest.md)| | | |
| 52 | + |
| 53 | +### Return type |
| 54 | + |
| 55 | +[**\Hostinger\Model\HostingV1CronJobsCronJobResource**](../Model/HostingV1CronJobsCronJobResource.md) |
| 56 | + |
| 57 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 58 | +[[Back to Model list]](../../README.md#models) |
| 59 | +[[Back to README]](../../README.md) |
| 60 | + |
| 61 | +## `deleteAccountCronJobV1()` |
| 62 | + |
| 63 | +```php |
| 64 | +deleteAccountCronJobV1($username, $uid): \Hostinger\Model\CommonSuccessEmptyResource |
| 65 | +``` |
| 66 | + |
| 67 | +Delete account cron job |
| 68 | + |
| 69 | +Permanently deletes the cron job identified by its uid. The uid is returned by the list cron jobs endpoint. |
| 70 | + |
| 71 | +### Example |
| 72 | + |
| 73 | +```php |
| 74 | +<?php |
| 75 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 76 | + |
| 77 | + |
| 78 | +// Configure Bearer authorization: apiToken |
| 79 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 80 | + |
| 81 | + |
| 82 | +$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config); |
| 83 | +$username = u123456789; // string |
| 84 | +$uid = cron_abc123; // string | Unique identifier of the cron job as returned by the list cron jobs endpoint. |
| 85 | + |
| 86 | +try { |
| 87 | + $result = $apiInstance->deleteAccountCronJobV1($username, $uid); |
| 88 | + print_r($result); |
| 89 | +} catch (Exception $e) { |
| 90 | + echo 'Exception when calling HostingCronJobsApi->deleteAccountCronJobV1: ', $e->getMessage(), PHP_EOL; |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +### Parameters |
| 95 | + |
| 96 | +| Name | Type | Description | Notes | |
| 97 | +| ------------- | ------------- | ------------- | ------------- | |
| 98 | +| **username** | **string**| | | |
| 99 | +| **uid** | **string**| Unique identifier of the cron job as returned by the list cron jobs endpoint. | | |
| 100 | + |
| 101 | +### Return type |
| 102 | + |
| 103 | +[**\Hostinger\Model\CommonSuccessEmptyResource**](../Model/CommonSuccessEmptyResource.md) |
| 104 | + |
| 105 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 106 | +[[Back to Model list]](../../README.md#models) |
| 107 | +[[Back to README]](../../README.md) |
| 108 | + |
| 109 | +## `getCronJobOutputV1()` |
| 110 | + |
| 111 | +```php |
| 112 | +getCronJobOutputV1($username, $uid): \Hostinger\Model\HostingV1CronJobsCronJobOutputResource |
| 113 | +``` |
| 114 | + |
| 115 | +Get cron job output |
| 116 | + |
| 117 | +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. |
| 118 | + |
| 119 | +### Example |
| 120 | + |
| 121 | +```php |
| 122 | +<?php |
| 123 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 124 | + |
| 125 | + |
| 126 | +// Configure Bearer authorization: apiToken |
| 127 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 128 | + |
| 129 | + |
| 130 | +$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config); |
| 131 | +$username = u123456789; // string |
| 132 | +$uid = cron_abc123; // string | Unique identifier of the cron job as returned by the list cron jobs endpoint. |
| 133 | + |
| 134 | +try { |
| 135 | + $result = $apiInstance->getCronJobOutputV1($username, $uid); |
| 136 | + print_r($result); |
| 137 | +} catch (Exception $e) { |
| 138 | + echo 'Exception when calling HostingCronJobsApi->getCronJobOutputV1: ', $e->getMessage(), PHP_EOL; |
| 139 | +} |
| 140 | +``` |
| 141 | + |
| 142 | +### Parameters |
| 143 | + |
| 144 | +| Name | Type | Description | Notes | |
| 145 | +| ------------- | ------------- | ------------- | ------------- | |
| 146 | +| **username** | **string**| | | |
| 147 | +| **uid** | **string**| Unique identifier of the cron job as returned by the list cron jobs endpoint. | | |
| 148 | + |
| 149 | +### Return type |
| 150 | + |
| 151 | +[**\Hostinger\Model\HostingV1CronJobsCronJobOutputResource**](../Model/HostingV1CronJobsCronJobOutputResource.md) |
| 152 | + |
| 153 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 154 | +[[Back to Model list]](../../README.md#models) |
| 155 | +[[Back to README]](../../README.md) |
| 156 | + |
| 157 | +## `listAccountCronJobsV1()` |
| 158 | + |
| 159 | +```php |
| 160 | +listAccountCronJobsV1($username): \Hostinger\Model\HostingV1CronJobsCronJobResource[] |
| 161 | +``` |
| 162 | + |
| 163 | +List account cron jobs |
| 164 | + |
| 165 | +Returns the list of cron jobs configured for the specified account, including their schedule and command. |
| 166 | + |
| 167 | +### Example |
| 168 | + |
| 169 | +```php |
| 170 | +<?php |
| 171 | +require_once(__DIR__ . '/vendor/autoload.php'); |
| 172 | + |
| 173 | + |
| 174 | +// Configure Bearer authorization: apiToken |
| 175 | +$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); |
| 176 | + |
| 177 | + |
| 178 | +$apiInstance = new Hostinger\Api\HostingCronJobsApi(config: $config); |
| 179 | +$username = u123456789; // string |
| 180 | + |
| 181 | +try { |
| 182 | + $result = $apiInstance->listAccountCronJobsV1($username); |
| 183 | + print_r($result); |
| 184 | +} catch (Exception $e) { |
| 185 | + echo 'Exception when calling HostingCronJobsApi->listAccountCronJobsV1: ', $e->getMessage(), PHP_EOL; |
| 186 | +} |
| 187 | +``` |
| 188 | + |
| 189 | +### Parameters |
| 190 | + |
| 191 | +| Name | Type | Description | Notes | |
| 192 | +| ------------- | ------------- | ------------- | ------------- | |
| 193 | +| **username** | **string**| | | |
| 194 | + |
| 195 | +### Return type |
| 196 | + |
| 197 | +[**\Hostinger\Model\HostingV1CronJobsCronJobResource[]**](../Model/HostingV1CronJobsCronJobResource.md) |
| 198 | + |
| 199 | +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) |
| 200 | +[[Back to Model list]](../../README.md#models) |
| 201 | +[[Back to README]](../../README.md) |
0 commit comments