Code Samples #
Copy
curl --request POST \
--url 'https://app.xcloud.host/api/v1/servers/{uuid}/services/restart' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"service": "nginx",
"version": "8.2"
}'
const response = await fetch('https://app.xcloud.host/api/v1/servers/{uuid}/services/restart', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"service": "nginx",
"version": "8.2"
})
});
const data = await response.json();
console.log(data);
import requests
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"service": "nginx",
"version": "8.2"
}
response = requests.post("https://app.xcloud.host/api/v1/servers/{uuid}/services/restart", headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://app.xcloud.host/api/v1/servers/{uuid}/services/restart',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_TOKEN',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => '{
"service": "nginx",
"version": "8.2"
}',
]);
$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("POST"), "https://app.xcloud.host/api/v1/servers/{uuid}/services/restart");
request.Headers.Add("Authorization", "Bearer YOUR_TOKEN");
request.Content = new StringContent(@"{
""service"": ""nginx"",
""version"": ""8.2""
}", 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/servers/{uuid}/services/restart"))
.header("Authorization", "Bearer YOUR_TOKEN")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"service": "nginx",
"version": "8.2"
}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response #
Copy
{
"success": true,
"message": "NGINX restarted successfully",
"data": null
}
{
"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": "An error occurred.",
"data": null
}
{
"success": false,
"message": "An error occurred.",
"data": null
}
Restarts a single Server service, addressed by name in the request body (e.g. nginx, lsws, php, redis, docker, supervisor, mysql, mariadb). For PHP servers running multiple versions, supply version to disambiguate. The restart runs synchronously over SSH. Node.js is a runtime and cannot be restarted; PHP cannot be restarted on OpenLiteSpeed servers (they use LSAPI). Requires the write:servers scope.
Path Parameters #
| Name | Type | Required | Description |
|---|---|---|---|
uuid | string (uuid) | Required | UUID of the Server |
Request Body #
Content type: application/json — required
| Field | Type | Required | Description |
|---|---|---|---|
service | string | Required | Service name to restart. Allowed: mysql, mariadb, postgresql, nginx, redis, php, ssh, supervisor, docker, lsws, nodejs, openclaw, paperclip, hermes |
version | string | Optional | Optional version selector (PHP services only). |
Example request
Copy
{
"service": "nginx",
"version": "8.2"
}
Responses #
200 — Service restarted #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 200 response
Copy
{
"success": true,
"message": "NGINX restarted successfully",
"data": null
}
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 — Server not found, or the requested service is not present on the Server. #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 404 response
Copy
{
"success": false,
"message": "An error occurred.",
"data": null
}
422 — Server not connected, the service cannot be restarted in its current state, or validation failed. #
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | Optional | |
message | string | Optional | |
data | object | Optional |
Example 422 response
Copy
{
"success": false,
"message": "An error occurred.",
"data": null
}
