API Edit Template

From Virtualizor Wiki
Jump to: navigation, search

Edit Template

Parameters Description
cplan Virtualization Type
template Template Type
url URL of the template
filename New file name
hvm_pass New pass for the template
drive Drive Type
extra Extra Config parameters
osid OSID of the template

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['cplan']    = 'kvm';
    $post['template'] = 'others';
    $post['url']      = '';
    $post['filename'] = 'windows_2003R264.img';
    $post['hvm_pass'] = '';
    $post['drive']    = '';
    $post['extra']    = ''; 
    $post['osid']     = '100008';

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

Returns:

Array
(
    [title] => Edit OS Template
    [done] => 1
    [theos] => Array
        (
            [type] => kvm
            [url] => 
            [filename] => windows_2003R264.img
            [name] => windows_2003R264.img
            [fstype] => ext3
            [size] => 5368709120
            [distro] => others
        )

    [mgs] => Array
        (
            [1] => Array
                (
                    [mgid] => 1
                    [mg_name] => test
                    [mg_desc] => test
                    [mg_type] => kvm
                )

        )

    [timenow] => 1403161736
    [time_taken] => 0.023
)