API Reference
POST
control_server_serviceControl Service Action
Control Service Action is a POST request to https://api.sharkcluster.com/control_server_service in the Server Management section of the SharkCluster API. Perform system-level actions (Start, Stop, Restart, Purge) on specific services like Nginx, MySQL, or Redis running on a server. It takes 3 parameters, 3 required (server_id, service and mode).
Request URL
POST
https://api.sharkcluster.com/control_server_serviceHow do you call Control Service Action?
- 1Get a token from the login endpoint (POST /login) and send it as Authorization: Bearer <token>. See Login.
- 2Send a POST request to https://api.sharkcluster.com/control_server_service.
- 3Include the required parameters: server_id, service and mode.
Request parameters
| Parameter | Type | Description |
|---|---|---|
server_idRequired | string | Internal Database ID of the server. |
serviceRequired | string | Service: apache2, nginx, php-fpm, mysql, redis-server, varnish, memcached. |
modeRequired | string | Action to take: start, stop, restart, enable, disable, purge. |
What does Control Service Action return?
A successful call returns a JSON object with the fields result, message, server_id, service and mode. Check that result is true in the body: like many SharkCluster endpoints, a failure can come back with HTTP 200 and result: false.
Request sample
const axios = require('axios');
const data = {
server_id: "0000-1111-2222",
service: "redis-server",
mode: "purge" // Options: restart, start, stop, purge, enable, disable
};
axios.post('https://api.sharkcluster.com/control_server_service', data, {
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
}
})
.then(res => {
console.log("Success:", res.data.message);
})
.catch(err => {
console.error("Error:", err.response ? err.response.data : err.message);
});
Response
{
"result": true,
"message": "Service redis-server restarted successfully!",
"server_id": "00000000-0000-4000-8000-000000000008",
"service": "redis-server",
"mode": "restart"
}Related Server Management endpoints
Stuck on an integration?
Raise a ticket from the panel with the endpoint and the response you got back — it reaches an engineer with your server already attached.