Get Virtualizor

Edit User

Use the Edit User API to update the user information of the user present on the Virtualizor panel. Using this API you can update details of a normal user, cloud user and admin user. The API response will contain "done" as "1" on successful update of the user.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETedituserThe action specified to perform operation and retrieve data after user editing has been doneYes
uidGET
IntThe user ID that needs to be editedYes
priorityPOSTIntThis specifies if the user is a user(0) or admin(1) or cloud (2)Yes
newpassPOSTtextThe password of the userYes
newemailPOSTtextThe email of the userYes
fnamePOSTtextThe first name of the userNo
lnamePOSTtextThe last name of the userNo
dnsplan_idPOSTIntThe dnsplan ID for the userNo
acl_idPOSTIntAccess Control ID for the userNo
num_vsPOSTIntThe maximum number of Virtual Private Servers this user can create. Zero (0) for unlimitedNo
num_usersPOSTIntThe maximum number of sub-users this user can create. Zero (0) for unlimitedNo
spacePOSTIntThe maximum disk space in GB that the user can use to create the vpsNo
ramPOSTIntThe maximum amount of ram in MB that the user can use to create the vpsNo
burstPOSTIntThe maximum amount of swap ram (For Other Kernels )or burst ram (For Open Vz) in MB that the user can use to create the vpsNo
bandwidthPOSTIntThe total bandwidth assigned to the userNo
cpuPOSTIntThe default cpu weight assigned to the user to create vpsNo
coresPOSTIntThe maximum number of cpu cores that the user can use to create the vpsNo
cpu_percentPOSTIntAll VPS created by the user would have this CPU %. This is per core base. E.g. If user creates VPS with 2 cores and percentage is 40 total 80% will be assigned.No
num_coresPOSTIntThe total number of cores allowed. Zero (0) means unlimited coresNo
num_ipv4POSTIntThe total number of ipv4 addresses that will be used for the vpsNo
num_ipv6_subnetPOSTIntThe total number of ipv6 subnet that will be used for the vpsNo
num_ipv6POSTIntThe total number of ipv6 addresses that will be used for the vpsNo
network_speedPOSTIntThe total network speed in KB/sNo
upload_speedPOSTIntThe total upload speed in KB/sNo
band_suspendPOST1/0If checked then all the cloud user's VPS(s) will be suspended if the specified bandwidth limit is exceededNo
service_periodPOSTIntThe billing cycle start date for bandwidth calculation (1-31)No
allowed_virtsPOSTarrayThe Virtualization type to allow this user (openvz,xen,xenhvm,kvm, xcp, xcphvm,lxc, proxo, proxk, proxl, vzk, vzo)No
sgsPOSTarrayThe array of servergroup that the user can useNo
mgsPOSTarrayThe array of media groups that the user can useNo
space_per_vmPOSTIntThe maximum space per vpsNo
total_iops_secPOSTIntThe total Iops per second (Only supported for kvm and proxk)
No
read_bytes_secPOSTIntThe read Iops per second (Only supported for kvm and proxk) No
write_bytes_secPOSTIntThe write Iops per second (Only supported for kvm and proxk)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);

    $post = array();
    $post['uid'] = 372;
    $post['edituser'] = 1;
    $post['priority'] = 2;
    $post['newemail'] = 'test@test.comsss';
    $post['newpass'] = 'avinsh_123';
    $post['dnsplan_id'] = 13;
    $post['fname'] = 'test';
    $post['lname'] = 'test';
    $post['acl_id'] = 0;   
    $post['num_vs'] = 100000;
    $post['num_users'] = 15;
    $post['ram'] = 2048;
    $post['burst'] = 1024;
    $post['bandwidth'] = 1000000;
    $post['cpu'] = 1024;
    $post['cores'] = 8;
    $post['cpu_percent'] = 50;
    $post['num_cores'] = 10000;
    $post['num_ipv4'] = 50;
    $post['num_ipv6_subnet'] = 0;
    $post['num_ipv6'] = 0;
    $post['network_speed'] = 0;
    $post['upload_speed'] = 0;
    $post['service_period'] = 1;
    $post['allowed_virts'] = array('kvm', 'openvz');

    $output = $admin->edituser($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Edit User",
    "done": 1,
    "user_plans": [],
    "users": {
        "uid": "62",
        "password": "",
        "email": "test@test.comsss",
        "type": "2",
        "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": "100000",
        "num_users": "15",
        "space": "0",
        "ram": "2048",
        "burst": "1024",
        "bandwidth": "1000000",
        "cpu": "1024",
        "cores": "8",
        "cpu_percent": "50",
        "num_cores": "10000",
        "num_ipv4": "50",
        "num_ipv6": "0",
        "num_ipv6_subnet": "0",
        "allowed_virts": [
            ""
        ],
        "network_speed": "0",
        "upload_speed": "0",
        "openvz": "0",
        "xen": "0",
        "xenhvm": "0",
        "kvm": "0",
        "sg": [],
        "mg": [],
        "preferences": {
            "fname": "test",
            "lname": "test"
        },
        "dnsplid": "13",
        "act_status": "1",
        "activation_code": "",
        "date_created": "1535728589",
        "service_period": "1",
        "band_suspend": "0",
        "billing_warn": null,
        "suspended": null
    },
    "mgs": {
        "1": {
            "mgid": "1",
            "mg_name": "test",
            "mg_desc": "test_desc",
            "mg_type": "openvz"
        }
    },
    "servergroups": {
        "0": {
            "sgid": 0,
            "sg_name": "Default",
            "sg_reseller_name": "Default",
            "sg_desc": "Default Group",
            "sg_select": 0
        },
        "2": {
            "sgid": "2",
            "sg_name": "test_sg",
            "sg_reseller_name": "US",
            "sg_desc": "This is just test",
            "sg_select": "0"
        }
    },
    "timenow": 1535986817,
    "time_taken": "0.275"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list