This article provides a guide for a VPS User to restart server using the VPS User API.
Use Restart VPS API to restart VPS on your server.
HTTP Request
https://vm1.apivps.com:4083/index.php?act=restart&svs=vpsid&do=1
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | restart | The action carried out to perform certain operation | Yes |
do | GET | 1 | IF set then the certain action will be carried out | Yes |
svs | POST | Int | The vps id is passed as a parameter to be restarted | Yes |
Sample Code
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = '';
$pass = '';
$ip = '';
$admin = new Virtualizor_Enduser_API($ip, $key, $pass);
$vid = 3332;
$output = $admin->restart($vid);
print_r(json_encode($output));
?>
Curl
curl -k -L "https://vm1.apivps.com:4083/index.php?
svs=3560&act=restart&api=json
&apikey=your_api_key&apipass=your_api_pass&do=1"
Output
{
"uid": "321",
"act": "restart",
"timezone": 1,
"timenow": "September 20, 2024, 6:52 am",
"vpsid": 3560,
"username": "abc@abc.com",
"user_type": "2",
"preferences": {
"fname": "test",
"lname": "test",
"theme": "default",
"language": "english",
"timezone": 1
},
"url": "index.php?",
"rdns": {
"pdnsid": null
},
"support_link": "http://radwebhosting.com",
"disable_login_logo": 1,
"title": "Restart VPS",
"done": {
"msg": "The VPS was restarted successfully"
},
"status": 0,
"output": "Domain v2090 created from /etc/libvirt/qemu/v2090.xmln",
"time_taken": "3.632"
}