Use Start Service API to start particular service on VPS of your server.
HTTP Request
https://hostname:4083/index.php?act=services&svs=vpsid
Parameters
Name | Type | Value | Description | Required |
---|---|---|---|---|
act | GET | services | The action which will list services that are running inside the vps. | Yes |
svs | POST | vpsid | The vpsid whose services have to be started. Will be sent via URL. | Yes |
vid | POST | vpsid | The vpsid whose services have to be started. Will be sent as a POST Parameter. | Yes |
start_x | POST | 1/0 | If set then the start method will start the process. | Yes |
sel_serv | POST | sel_serv | Name of the service that needs to be started. | Yes |
Sample Code
PHP
<?php
require_once('/usr/local/virtualizor/sdk/enduser.php');
$key = 'your_api_key';
$pass = 'you_api_pass';
$ip = 'your_Server_ip';
$admin = new Virtualizor_Enduser_API($ip, $key, $pass);
$vid = 3615;
$post['start_x'] = 1;
$post['sel_serv'][] = 'httpd';
$post['sel_serv'][] = 'httpd';
$output = $admin->services($post,$vid);
print_r(json_encode($output));
?>
Curl
curl -k -X POST -d "start_x=1&sel_serv[]=httpd" -L
"https://hostname:4083/index.php?act=services&
svs=3615&api=json&apikey=your_api_key&
apipass=you_api_pass"
Output
{
"uid": "372",
"act": "services",
"timezone": 1,
"timenow": "October 11, 2016, 3:18 am",
"vpsid": 3615,
"username": "test@test.com",
"user_type": "2",
"preferences": {
"fname": "test",
"lname": "test",
"language": "english",
"theme": "default",
"timezone": 1,
"logo": ""
},
"url": "index.php?",
"rdns": {
"pdnsid": "12"
},
"pdns": {
"pdnsid": "12"
},
"support_link": "http://softaculous.com",
"title": "Services",
"services": {
"0": "init",
"1": "kthreadd/105",
"2": "khelper/105",
"3": "udevd",
"4": "rc",
"5": "rsyslogd",
"6": "xinetd",
"7": "saslauthd",
"8": "S80sendmail",
"9": "sendmail",
"10": "bash",
"11": "sshd",
"12": "httpd",
"13": "crond",
"15": "iptables",
"16": "modules_dep",
"17": "network",
"18": "rsyslog",
"22": "vzquota"
},
"autostart": ["crond", "httpd", "iptables", "modules_dep", "network", "rsyslog", "saslauthd", "sendmail", "sshd", "vzquota", "xinetd"],
"running": {
"1": "init",
"2": "kthreadd/105",
"3": "khelper/105",
"4": "udevd",
"5": "rc",
"6": "rsyslogd",
"7": "xinetd",
"8": "saslauthd",
"10": "S80sendmail",
"11": "sendmail",
"12": "bash",
"14": "sshd",
"15": "httpd"
},
"time_taken": "1.609"
}