Add Plan

Use the Add Plan API to create plans on the Virtualizor panel. Plans help facilitate the creation of Virtual Private Servers on your server. The API response will contain “done” as “1” on successful creation of the plan.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actPOSTaddplanThe action specified to perform operation and will return “done” as “1” on successful creation of the planYes
plan_namePOSTtextName of the planYes
cplanPOSTtextThe Virt type of Plan(openvz,kvm,xcp,xcphvm,xen,xenhvm,lxc,vzo,vzk, proxo, proxk, proxl)Yes
disk_spacePOSTIntAmount of disk space in GB for the VPSYes
guaranteed_ramPOSTIntAmount of ram in MB for the VPSYes
swapramPOSTIntAmount of swap ram for the VPS (Required for kvm,xcp, xcphvm, xen, xenhvm, lxc, vzo, vzk, proxo )Yes
burst_ramPOSTIntAmount of burst ram for the VPS(Required for OpenVz )No
bandwidthPOSTIntNetwork bandwidth in GB(Setting 0 will set bandwidth to unlimited)Yes
network_speedPOSTIntNetwork speed in KB/sNo
cpu_unitsPOSTIntThe amount of CPU units to be setYes
cpu_coresPOSTIntThe amount of CPU cores to be setYes
percent_cpuPOSTIntThe total amount of CPU processing in percent to be given to a VPSYes
priorityPOSTIntRequired I/O priority (Required for OpenVz ). Valid values are 1-7.No
ipsPOSTIntThe number IPv4 ipsNo
ips6_subnetPOSTIntThe number of ipv6 subnetNo
ips6POSTIntThe number of ipv6 addressNo
ips_intPOSTIntThe number of internal ips to be specifiedNo
ploopPOST1/01 to enable ploopNo
virtioPOST1/0This will enable/disable virtio for the vpsNo
acpiPOST1/0This will enable/disable acpi for the vpsNo
apicPOST1/0This will enable/disable apic for the vpsNo
paePOST1/0This will enable/disable pae for the vpsNo
mgsPOSTarrayThis will assign the media group to the vpsNo
upload_speedPOSTIntThe upload speed for the vps in KB/sNo
band_suspendPOST1/0The bandwidth suspension option will be enabled for the vpsNo
dnsPOSTarrayThe array of DNS ips will be assigned to the vpsNo
ippoolidPOSTarrayThe array of Ip pool IDNo
nic_typePOSTtextThis will assign a network interface card. If not selected the default card Realtek will be assigned refer below table for valuesNo
control_panelPOSTtextThe control panel selected will be installed on the vps (cpanel, webuzo, plesk, webmin, interworx,ispconfig, cwp, vesta)No
recipePOSTIntA recipe will be assigned to the vpsNo
cpu_modePOSTtextRefer Values from below tableNo
enable_cpu_topologyPOST1/0This will enable the cpu topology to the vpsNo
topology_socketsPOSTIntIF cpu topology is enabled then Specify the number of CPU Sockets to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
topology_coresPOSTIntIF cpu topology is enabled then Specify the number of CPU cores to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
topology_threadsPOSTIntIF cpu topology is enabled then Specify the number of CPU Threads to be assigned to the VPS (Only for KVM, Proxmox KVM, XCP)No
vnc_keymapPOSTtextAllows to select keymap can be ‘en-us’, ‘de-ch’, ‘ar’, ‘da’, ‘et’, ‘fo’, ‘fr-be’, ‘fr-ch’, ‘hu’, ‘it’, ‘lt’, ‘mk’, ‘nl’, ‘no’, ‘pt’, ‘ru’, ‘sv’, ‘tr’, ‘de’, ‘en-gb’, ‘es’, ‘fi’, ‘fr’, ‘fr-ca’, ‘hr’, ‘is’, ‘ja’, ‘lv’, ‘nl-be’, ‘pl’, ‘pt-br’, ‘sl’, ‘th’No
kvm_cachePOSTtextThe type disk-cache mechanism can be writeback, writethrough, directsync or default (Only for KVM and Proxmox KVM)No
io_modePOSTtextSets the I/O policy for the VPS can be native/threads (Only for KVM)No
kvm_vgaPOST1/0Enables VGA for the VPS (Only for KVM)No
accelerationPOST1/0If VGA is enabled then this option will enable 2D and 3D acceleration will be for the VPSNo
total_iops_secPOSTIntAssigns Total I/O time to the vpsNo
read_bytes_secPOSTIntAssigns Read MB/s value to the vpsNo
write_bytes_secPOSTIntAssigns Write MB/s value to the vpsNo
rdpPOST1/0Enables RDP for the vpsNo
osreinstall_limitPOSTIntSet OS reinstall limit to the vpsNo
admin_managedPOST1/0If checked, VPS can not be managed from Enduser panelNo
disable_nw_configPOST1/0If checked, Virtualizor will not configure/re-write network when a VPS is rebooted. However, during creation of the VPS, the network file will be writtenNo
plan_templatePOSTIntWill copy the plan given in the plan IDNo
tuntapPOST1/0Enable disable for VPSNo
pppPOST1/0Enable disable ppp for VPSNo
fusePOST1/0Enable disable fuse for ContainersNo
ipipPOST1/0Enable disable ipip for ContainersNo
ipgrePOST1/0Enable disable ipgre for ContainersNo
nfsPOST1/0Enable disable nfs for ContainersNo
quotaugidlimitPOSTIntEnables or disables in-container per-user and per-group disk quotas. If the value is set to 0 or not set, disk quotas inside the container is disabled and not accountedNo
iolimitPOSTIntIf set, IO operation will not exceed the specified limit while performing IO operations.No
iopslimitPOSTIntIf set, IO operations per second will not exceed the soecified limitNo
install_xentoolsPOST1/0If enabled will install xentools for XENNo
shadowPOSTIntShadow Memory in MB Recommended value 8 MBNo
pv_on_hvmPOST1/0The primary goal of PV on HVM is to boost performance of fully virtualized HVM guests through use of specially optimized paravirtual device driversNo
vif_typePOSTtextIf you want to change the network interface emulation type. Options are netfront or ioemuNo
numaPOST1/0Enable disable Numa for Proxmox KVM/QemuNo
h_rate[-1]POSTIntHourly Pricing Rate for server, for specific server you need to pass server ID in place of ‘-1’No
m_rate[-1]POSTIntMonthly Pricing Rate for server, for specific server you need to pass server ID in place of ‘-1’No
y_rate[-1]POSTIntYearly Pricing Rate for server, for specific server you need to pass server ID in place of ‘-1’No

CPU Mode values for KVM

( host-model | host-passthrough )

CPU Mode values for Proxmox KVM

( host-model | host-passthrough | 486 | athlon | pentium | pentium2 | pentium3 | coreduo | core2duo | kvm32 | qemu32 | qemu64 | phenom | Conroe | Penryn | Nehalem | SandyBridge | IvyBridge | Haswell | Broadwell | Opteron_G1 | Opteron_G2 | Opteron_G3 | Opteron_G4 | Opteron_G5 )

Nic Types Values

KernalNic Type
KVM, Virtuozzo KVMvirtio,default,e1000
Proxomox KVMdefault,virtio,e1000,ne2k_pci,i82559er,pcnet,ne2k_isa,vmxnet3
XCPdefault, e1000
XENdefault,e1000,ne2k_pci

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['plan_name'] = 'test_api_plan';
    $post['cplan'] = 'kvm';
    $post['disk_space'] = 5;
    $post['guaranteed_ram'] = 1024;
    $post['swapram'] = 1024;
    $post['bandwidth'] = 0;
    $post['burst_ram'] = 0; //Required For OpenVZ
    $post['priority'] = 3;
    $post['network_speed'] = 0;
    $post['cpu_units'] = 1024;
    $post['topology_sockets'] = 0;
    $post['topology_cores'] = 0;
    $post['topology_threads'] = 0;
    $post['cpu_cores'] = 4;
    $post['percent_cpu'] = 0;
    $post['ips'] = 1;
    $post['ips6'] = 0;
    $post['ips6_subnet'] = 0;
    $post['ips_int'] = 0;
    $post['nic_type'] = 'e100';
    $post['acpi'] = 1;
    $post['apic'] = 1;
    $post['pae'] = 1;
    $post['virtio'] = 0;
    $post['ploop'] = 0;
    $post['band_suspend'] = 0;
    $post['upload_speed'] = 0;
    $post['tuntap'] = 0; 
    $post['ppp'] = 0;
    $post['rdp'] = 1;
    $post['ubcsettings'] = 0;
    $post['control_panel'] = 'cpanel';
    $post['cpu_mode'] = 'host-model';
    $post['sec_iso'] = 0;
    $post['iso'] = 0;
    $post['osreinstal_limit'] = 10;
    $post['osid'] = 347;
    $post['kvm_vga'] = 1;
    $post['acceleration'] = 0;
    $post['vnc'] = 1;
    $post['admin_managed'] = 0;
    $post['recipe'] = 18;
    $post['disable_nw_config'] = 0;
    $post['shadow'] = 8;
    $post['pv_on_hvm'] = 0;
    $post['vif_type'] = '';
    $post['mgs'] = 16;
    $post['dns'] = array('4.2.2.1','4.2.2.2');
    $post['vnc_keymap'] = 'en-us';
    $post['kvm_cache'] = 'writeback';
    $post['io_mode'] = 0;
    $post['total_iops_sec'] = 10;
    $post['read_bytes_sec'] = 10;
    $post['write_bytes_sec'] = 10;

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Add Plan",
    "done": 1,
    "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": 1535645059,
    "time_taken": "0.238"
}
Was this helpful to you?