List Services

Use List Services API to get all available services on VPS of your server.

To Start, Stop, Restart the services you can first run the curl command to list services and select the particular service.

HTTP Request

https://hostname:4083/index.php?act=services&svs=3615

Parameters

NameTypeValueDescriptionRequired
actGETservicesThe action will list services that are currently running inside the vpsYes
svsPOSTvpsidThe vpsid whose services have to be listed. Will be sent via URLYes
vidPOSTvpsidThe vpsid whose services have to be listed. Will be sent as a POST ParameterYes

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Enduser_API($ip, $key, $pass);

    $vid = 3615;

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

    print_r(json_encode($output));
?>

Curl

curl -k -X GET -L "https://hostname:4083/index.php?act=services& 
svs=3615&api=json&apikey=your_api_key& 
apipass=your_api_pass"

Output

{
    "uid": "372",
    "act": "services",
    "timezone": 1,
    "timenow": "October 11, 2016, 2:11 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": ["systemd", "kthreadd/105", "khelper/105", "sshd", "agetty", "network", "vzquota"],
    "autostart": ["network", "vzquota"],
    "running": {
        "1": "systemd",
        "2": "kthreadd/105",
        "3": "khelper/105",
        "5": "sshd",
        "6": "agetty"
    },
    "time_taken": "0.393"
}
Was this helpful to you?