Use the Stop VPS API to stop the VPS present on your server by passing the VPS ID to the API. The API response returns "done" as "true" after the VPS is stopped/shutdown successfully.
HTTP Request
https://hostname:4085/index.php?act=vs&action=stop&vpsid=VPSID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | vs | The action specified to retrieve data after vps is stopped | Yes |
vpsid | GET | Int | The ID of the vps that need to be stopped | Yes |
action | GET | text | The value of the action should be "stop" for stopping the VPS | Yes |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$vid = 51;
$output = $admin->stop($vid);
print_r(json_encode($output));
?>
Output
{
"title": "Virtual Servers",
"done": true,
"done_msg": "Shutdown signal has been sent to the VPS",
"vsop": {
"action": "stop",
"id": 51,
"serid": "0",
"output": "Domain f37ea5ce-c1c8-46b3-acb0-a6a51319c683 is being shutdown\n",
"status": {
"51": 1
}
},
"timenow": 1535126028,
"time_taken": "0.234"
}