List Users

Use the List Users API to list the users information present on the Virtualizor panel. The API response contains a list of information of the users, listed according the user’s IDs. To filter or limit the size of the list, you can specify one or more query parameters.

HTTP Request

https://hostname:4085/index.php?act=users

Parameters

NameMethodValueDescriptionRequired
actGETusersThe action will return list of usersYes
pagePOSTIntPage number, each page show 50 recordsNo
reslenPOSTIntNumber of records to be returned, default is 50No
uidPOSTIntThe user ID that needs to be searchedNo
emailPOSTtextThe user emailNo
user_typePOSTIntThe type of user (0 for User, 1 for Admin and 2 for cloud)No

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);

    $page = 1;
    $reslen = 20;
    $post = array();
    $post['uid'] = '';
    $post['email'] = '';
    $post['user_type'] = '';

    $output = $admin->users($page, $reslen, $post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Users",
    "users": {
        "55": {
            "uid": "55",
            "password": "",
            "email": "tt@rrr.com",
            "type": "0",
            "aclid": "0",
            "pid": "0",
            "uplid": "0",
            "inhouse_billing": "0",
            "cur_bal": "0.00",
            "cur_usage": "0.00",
            "cur_invoices": "0.00",
            "max_cost": "0",
            "num_vs": "0",
            "num_users": "0",
            "space": "0",
            "ram": "0",
            "burst": "0",
            "bandwidth": "0",
            "cpu": "0",
            "cores": "4",
            "cpu_percent": "0",
            "num_cores": "0",
            "num_ipv4": "0",
            "num_ipv6": "0",
            "num_ipv6_subnet": "0",
            "allowed_virts": "",
            "network_speed": "0",
            "upload_speed": "-1",
            "openvz": "0",
            "xen": "0",
            "xenhvm": "0",
            "kvm": "0",
            "sg": "",
            "mg": "",
            "preferences": "a:2:{s:5:\"fname\";s:0:\"\";s:5:\"lname\";s:0:\"\";}",
            "dnsplid": "0",
            "act_status": "1",
            "activation_code": "",
            "date_created": "1534250148",
            "service_period": "1",
            "band_suspend": "0",
            "billing_warn": null,
            "suspended": null,
            "numvps": "1",
            "bw_used": "0.00"
        }
    },
    "timenow": 1535725883,
    "time_taken": "0.423"
}
Was this helpful to you?