Virtualizor allows creation plans for normal user, admin user and cloud user. User Plans help facilitate creation of the users. For cloud users, plans allows you to set the limits of the parameters of the VPS and the number of the other users that the cloud user can create.
Use the List User Plans API to list all the plans of the user added by the. The list will contain all the information of the user plan which is listed according to the plan ID. To filter or limit the size of the list pass in one or more query parameter.
HTTP Request
https://hostname:4085/index.php?act=user_plans
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | user_plans | The act will list the user plans | Yes |
page | GET | Int | If not specified, then only first 50 records are returned | No |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
planname | POST | text | Filter the list according to plan name | No |
ptype | POST | text | Filter the list according to plan type, for valid values refer the table below | No |
Plan Type
( openvz | xen | kvm | xcp | lxc | vzo | vzk ) |
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();
$output = $admin->list_user_plans($page, $reslen, $post);
print_r(json_encode($output));
?>
Output
{
"title": "Plans",
"plans": {
"1": {
"uplid": "1",
"plan_name": "New 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": "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",
"sg": "",
"mg": "",
"dnsplid": "0",
"service_period": "1",
"band_suspend": "0",
"date_created": "1534518872"
}
},
"timenow": 1537470364,
"time_taken": "0.136"
}