Stop VPS

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

NameMethodValueDescriptionRequired
actGETvsThe action specified to retrieve data after vps is stoppedYes
vpsidGETIntThe ID of the vps that need to be stoppedYes
actionGETtextThe value of the action should be “stop” for stopping the VPSYes

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"
}
Was this helpful to you?