Get Virtualizor

Edit User Plan

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

NameMethodValueDescriptionRequired
actGETedituser_plansThe action specified to perform the operation and will return "done" as "true" on successYes
uplidGETIntThe user plan ID to be editedYes
plan_namePOSTtextThe unique name of the planYes
priorityPOSTIntThe type of user plan 0 for normal user, 1 admin user, 2 for cloudYes
dnsplan_idPOSTIntThe ID of the dns planNo
acl_idPOSTIntThe acl ID for admin userNo
num_vsPOSTIntThe maximum number of Virtual Private Servers this user can create. Zero (0) for unlimitedNo
inhouse_billingPOST1/0If enabled, Virtualizor will calculate resource usage and create invoices for the VPSesNo
num_usersPOSTIntThe maximum number of sub-users this user can create. Zero (0) for unlimited.No
spacePOSTIntMax Disk Space in GBNo
ramPOSTIntThe Maximum amount ram in MBNo
burstPOSTIntThe Maximum amount burst in MBNo
bandwidthPOSTIntZero (0) means unlimited bandwidthNo
cpuPOSTIntDefault CPU weightNo
coresPOSTIntMax Cores / VPS.The user cannot create a VPS above this limitNo
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 max number of ipv4 ips that the user can createNo
num_ipv6_subnetPOSTIntThe max number of ipv6 subnet that the user can createNo
num_ipv6POSTIntThe max number of ipv6 ips that the user can createNo
network_speedPOSTIntThe network speed in KB/s. Pass 0 or leave empty for no restriction.No
upload_speedPOSTIntThe upload speed in KB/s. Pass 0 or leave empty for no restriction.No
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, valid values (0-31)No
allowed_virtsPOSTarrayThe Virtualization type to allow this user refer below table for valid valuesNo
sgsPOSTarrayThe array of server group IDsNo
mgsPOSTarrayThe array of media group valuesNo
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

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"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list