Use the Edit User Plan API to update a user plan, by passing the user's plan ID. The plan ID can be obtained from List User Plans API. Using this API you can update the plans for Admin, Cloud and Normal user. The API response will contain "done" as "true" on successful update of the plan.
HTTP Request
https://hostname:4085/index.php?act=edituser_plans&uplid=UPLID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | edituser_plans | The action specified to perform the operation and will return "done" as "true" on success | Yes |
uplid | GET | Int | The user plan ID to be edited | Yes |
plan_name | POST | text | The unique name of the plan | Yes |
priority | POST | Int | The type of user plan 0 for normal user, 1 admin user, 2 for cloud | Yes |
dnsplan_id | POST | Int | The ID of the dns plan | No |
acl_id | POST | Int | The acl ID for admin user | No |
num_vs | POST | Int | The maximum number of Virtual Private Servers this user can create. Zero (0) for unlimited | No |
inhouse_billing | POST | 1/0 | If enabled, Virtualizor will calculate resource usage and create invoices for the VPSes | No |
num_users | POST | Int | The maximum number of sub-users this user can create. Zero (0) for unlimited. | No |
space | POST | Int | Max Disk Space in GB | No |
ram | POST | Int | The Maximum amount ram in MB | No |
burst | POST | Int | The Maximum amount burst in MB | No |
bandwidth | POST | Int | Zero (0) means unlimited bandwidth | No |
cpu | POST | Int | Default CPU weight | No |
cores | POST | Int | Max Cores / VPS.The user cannot create a VPS above this limit | 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 max number of ipv4 ips that the user can create | No |
num_ipv6_subnet | POST | Int | The max number of ipv6 subnet that the user can create | No |
num_ipv6 | POST | Int | The max number of ipv6 ips that the user can create | No |
network_speed | POST | Int | The network speed in KB/s. Pass 0 or leave empty for no restriction. | No |
upload_speed | POST | Int | The upload speed in KB/s. Pass 0 or leave empty for no restriction. | 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, valid values (0-31) | No |
allowed_virts | POST | array | The Virtualization type to allow this user refer below table for valid values | No |
sgs | POST | array | The array of server group IDs | No |
mgs | POST | array | The array of media group values | 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 |
Allowed Virtualization
( openvz | xen | xenhvm | kvm | xcp | xcphvm | lxc | proxo | proxk | proxl | vzk | vzo ) |
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['uplid'] = 5;
$post['plan_name'] = 'api_plan';
$post['priority'] = 0;
$output = $admin->edit_user_plans($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit User Plans",
"done": true,
"user_plans": {
"uplid": "5",
"plan_name": "api_plan",
"type": "0",
"aclid": "0",
"inhouse_billing": "0",
"max_cost": "0",
"num_vs": "0",
"num_users": "0",
"space": "0",
"ram": "0",
"burst": "0",
"bandwidth": "0",
"cpu": "0",
"cores": "0",
"cpu_percent": "0",
"num_cores": "0",
"num_ipv4": "0",
"num_ipv6": "0",
"num_ipv6_subnet": "0",
"allowed_virts": [
""
],
"network_speed": "0",
"upload_speed": "0",
"sg": [
0
],
"mg": [
0
],
"dnsplid": "0",
"service_period": "1",
"band_suspend": "0",
"date_created": "1537471672"
},
"mgs": {
"3": {
"mgid": "3",
"mg_name": "testing for apia",
"mg_desc": "Testing for the api",
"mg_type": "kvm"
}
},
"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": 1537474272,
"time_taken": "0.136"
}