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
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | edituser | The action specified to perform operation and retrieve data after user editing has been done | Yes |
uid | GET | Int | The user ID that needs to be edited | Yes |
priority | POST | Int | This specifies if the user is a user(0) or admin(1) or cloud (2) | Yes |
newpass | POST | text | The password of the user | Yes |
newemail | POST | text | The email of the user | Yes |
fname | POST | text | The first name of the user | No |
lname | POST | text | The last name of the user | No |
dnsplan_id | POST | Int | The dnsplan ID for the user | No |
acl_id | POST | Int | Access Control ID for the user | No |
num_vs | POST | Int | The maximum number of Virtual Private Servers this user can create. Zero (0) for unlimited | No |
num_users | POST | Int | The maximum number of sub-users this user can create. Zero (0) for unlimited | No |
space | POST | Int | The maximum disk space in GB that the user can use to create the vps | No |
ram | POST | Int | The maximum amount of ram in MB that the user can use to create the vps | No |
burst | POST | Int | The maximum amount of swap ram (For Other Kernels )or burst ram (For Open Vz) in MB that the user can use to create the vps | No |
bandwidth | POST | Int | The total bandwidth assigned to the user | No |
cpu | POST | Int | The default cpu weight assigned to the user to create vps | No |
cores | POST | Int | The maximum number of cpu cores that the user can use to create the vps | No |
cpu_percent | POST | Int | All 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_cores | POST | Int | The total number of cores allowed. Zero (0) means unlimited cores | No |
num_ipv4 | POST | Int | The total number of ipv4 addresses that will be used for the vps | No |
num_ipv6_subnet | POST | Int | The total number of ipv6 subnet that will be used for the vps | No |
num_ipv6 | POST | Int | The total number of ipv6 addresses that will be used for the vps | No |
network_speed | POST | Int | The total network speed in KB/s | No |
upload_speed | POST | Int | The total upload speed in KB/s | No |
band_suspend | POST | 1/0 | If checked then all the cloud user's VPS(s) will be suspended if the specified bandwidth limit is exceeded | No |
service_period | POST | Int | The billing cycle start date for bandwidth calculation (1-31) | No |
allowed_virts | POST | array | The Virtualization type to allow this user (openvz,xen,xenhvm,kvm, xcp, xcphvm,lxc, proxo, proxk, proxl, vzk, vzo) | No |
sgs | POST | array | The array of servergroup that the user can use | No |
mgs | POST | array | The array of media groups that the user can use | No |
space_per_vm | POST | Int | The maximum space per vps | No |
total_iops_sec | POST | Int | The total Iops per second (Only supported for kvm and proxk) | No |
read_bytes_sec | POST | Int | The read Iops per second (Only supported for kvm and proxk) | No |
write_bytes_sec | POST | Int | The 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"
}