API Edit Plan

From Virtualizor Wiki
Jump to: navigation, search
NOTE
This is OLD API Documentation. Click on the following link for New API Documentation
Admin API

Edit Plan

Parameters Description
plan_name New name for the Plan
cplan Type of Virtualisaton technology
disk_space Amount of disk space in GB
guaranteed_ram Amount of RAM in MB
swapram Amount of swap ram
burst_ram Last IP of the range if there are multiple IPs
bandwidth The first field of the Ipv6 address
network_speed The second field of the Ipv6 address
network_speed2 The third field of the Ipv6 address
cpu_units The fourth field of the Ipv6 address
cpu_cores The fifth field of the Ipv6 address
percent_cpu The sixth field of the Ipv6 address
priority The IP Pool id
ips The number of Ipv6 addresses
plid The server id in which the pool exists

Example Code

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['plan_name']		= 'xen';
    $post['cplan']		= 'xen';
    $post['disk_space']		= '10';
    $post['guaranteed_ram']	= '1204';
    $post['swapram']		= '1024';
    $post['burst_ram']		= '0';
    $post['bandwidth']		= '0';
    $post['network_speed']      = '0';
    $post['network_speed2']     = '0';
    $post['cpu_units']          = '1000';
    $post['cpu_cores']		= '4';
    $post['percent_cpu']	= '100.00';
    $post['priority']		= '0';
    $post['ips']		= '3';
    $post['plid']		=' 5';

    $output = $admin->editplan($post);
    print_r($output);
?>

Returns:

Array
(
    [title] => Edit Plan
    [done] => 1
    [plan] => Array
        (
            [plid] => 5
            [plan_name] => xen
            [virt] => xen
            [ips] => 3
            [space] => 10
            [inodes] => 0
            [ram] => 1204
            [burst] => 0
            [swap] => 1024
            [cpu] => 1000
            [cores] => 4
            [cpu_percent] => 100.00
            [bandwidth] => 0
            [network_speed] => 0
            [nic_type] => 
            [io] => 0
            [virtio] => 0
            [ubc] => 
        )

    [timenow] => 1403079159
    [time_taken] => 0.016
)