Code Samples #
Copy
curl --request PUT \
--url 'https://app.xcloud.host/api/v1/sites/{uuid}/cron-jobs/{cronJobUuid}' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"frequency": "every_minute",
"pattern": "*/5 * * * *",
"command": "php artisan schedule:run"
}'
const response = await fetch('https://app.xcloud.host/api/v1/sites/{uuid}/cron-jobs/{cronJobUuid}', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"frequency": "every_minute",
"pattern": "*/5 * * * *",
"command": "php artisan schedule:run"
})
});
const data = await response.json();
console.log(data);
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"frequency": "every_minute",
"pattern": "*/5 * * * *",
"command": "php artisan schedule:run"
}
response = requests.put("https://app.xcloud.host/api/v1/sites/{uuid}/cron-jobs/{cronJobUuid}", headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://app.xcloud.host/api/v1/sites/{uuid}/cron-jobs/{cronJobUuid}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_TOKEN',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => '{
"frequency": "every_minute",
"pattern": "*/5 * * * *",
"command": "php artisan schedule:run"
}',
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
using System.Net.Http;
using System.Text;
var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("PUT"), "https://app.xcloud.host/api/v1/sites/{uuid}/cron-jobs/{cronJobUuid}");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
request.Content = new StringContent(@"{
""frequency"": ""every_minute"",
""pattern"": ""*/5 * * * *"",
""command"": ""php artisan schedule:run""
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://app.xcloud.host/api/v1/sites/{uuid}/cron-jobs/{cronJobUuid}"))
.header("Authorization", "Bearer YOUR_TOKEN")
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("""
{
"frequency": "every_minute",
"pattern": "*/5 * * * *",
"command": "php artisan schedule:run"
}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response #
Copy
{
"success": true,
"message": "Operation completed successfully.",
"data": {
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"command": "php artisan schedule:run",
"user": "xcloud_example",
"frequency": "every_minute",
"frequency_label": "Every Minute",
"pattern": "* * * * *",
"status": "processing",
"site_uuid": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-01-15T09:30:00Z",
"updated_at": "2024-01-15T09:30:00Z"
}
}
{
"success": false,
"message": "Unauthenticated.",
"data": null
}
{
"success": false,
"message": "This action is unauthorized. Your token is missing the required scope.",
"data": null
}
{
"success": false,
"message": "Not found.",
"data": null
}
{
"success": false,
"message": "The given data was invalid.",
"data": null,
"errors": {
"domain": [
"The domain field is required when mode is live."
]
}
}
Path Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
uuid | string (uuid) | Required | UUID of the site |
cronJobUuid | string (uuid) | Required |
Request Body #
Content type: application/json — required
| Field | Type | Required | Description |
|---|---|---|---|
frequency | string | Required | Allowed: every_minute, every_five_minutes, every_ten_minutes, every_fifteen_minutes, every_thirty_minutes, hourly, weekly, monthly, on_reboot, custom |
pattern | string | Optional | |
command | string | Required |
Example request
Copy
{
"frequency": "every_minute",
"pattern": "*/5 * * * *",
"command": "php artisan schedule:run"
}
Responses #
200 — Cron job updated #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional | |
data | object | Optional | |
data.uuid | string (uuid) | Optional | |
data.command | string | Optional | |
data.user | string | Optional | |
data.frequency | string | Optional | Allowed: every_minute, every_five_minutes, every_ten_minutes, every_fifteen_minutes, every_thirty_minutes, hourly, weekly, monthly, on_reboot, custom |
data.frequency_label | string | Optional | |
data.pattern | string | Optional | |
data.status | string | Optional | Allowed: processing, active, inactive |
data.site_uuid | string (uuid) | Optional | |
data.created_at | string (date-time) | Optional | |
data.updated_at | string (date-time) | Optional |
Example 200 response
Copy
{
"success": true,
"message": "Operation completed successfully.",
"data": {
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"command": "php artisan schedule:run",
"user": "xcloud_example",
"frequency": "every_minute",
"frequency_label": "Every Minute",
"pattern": "* * * * *",
"status": "processing",
"site_uuid": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-01-15T09:30:00Z",
"updated_at": "2024-01-15T09:30:00Z"
}
}
401 — Missing or invalid authentication token #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 401 response
Copy
{
"success": false,
"message": "Unauthenticated.",
"data": null
}
403 — Token lacks the required scope #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 403 response
Copy
{
"success": false,
"message": "This action is unauthorized. Your token is missing the required scope.",
"data": null
}
404 — Resource not found or not accessible to your Team #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 404 response
Copy
{
"success": false,
"message": "Not found.",
"data": null
}
422 — Request validation failed #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional | |
errors | object | Optional |
Example 422 response
Copy
{
"success": false,
"message": "The given data was invalid.",
"data": null,
"errors": {
"domain": [
"The domain field is required when mode is live."
]
}
}
