Poweroff VPS

Use the Poweroff VPS API to poweroff the VPS present on your server. The API response returns “done” as “true” after the VPS is powered off successfully.

HTTP Request

https://hostname:4085/index.php?act=vs&action=poweroff&vpsid=VPSID

Parameters

NameMethodValueDescriptionRequired
actGETvsThe action specified to retrieve data after vps is powered offYes
vpsidGETIntThe ID of the vps which needs to be powered offYes
actionGETtextThe value of the action should be “poweroff” for powering off 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 = 3582;

    $output = $admin->poweroff($vid);

    print_r(json_encode($output));

?>

Output

{
  "title": "Virtual Servers",
  "done": true,
  "done_msg": "VPS has been powered off successfully",
  "vsop": {
    "action": "poweroff",
    "id": 51,
    "serid": "0",
    "output": "Domain f37ea5ce-c1c8-46b3-acb0-a6a51319c683 destroyed\n",
    "status": {
      "51": 0
    }
  },
  "timenow": 1535126334,
  "time_taken": "0.661"
}
Was this helpful to you?