Get Virtualizor

Restart VPS

Use the Restart VPS API to restart the VPS present on your server by passing the VPS ID to API. The API response returns "done" as "true" when a restart signal is sent to the VPS.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETvsThe action specified to retrieve data after vps is restartedYes
vpsidGETIntThe ID of the vps which needs to be restartedYes
actionGETtextThe value of the action should be "restart" for restarting 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->restart($vid);

    print_r(json_encode($output));

?>

Output

{
  "title": "Virtual Servers",
  "done": true,
  "done_msg": "Restart signal has been sent to the VPS",
  "vsop": {
    "action": "restart",
    "id": 51,
    "serid": "0",
    "output": "Domain v1009 created from /etc/libvirt/qemu/v1009.xml\n",
    "status": {
      "51": 1
    }
  },
  "timenow": 1535126160,
  "time_taken": "4.123"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list