API Add Distro

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

Add Distro

Parameters Type Description
add_distro POST Flag to add Distro
distro POST Distro name for System
distro_name POST Actual Name of Distro to be Displayed
distro_desc POST Description of Distro
distro_logo. POST Url of logo in PNG format of 64 x 64
distro_screenshot POST Url of Distro screenshot in PNG format of 250 pixels in width

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['add_distro'] = 1;
    $post['distro'] = 'distro';
    $post['distro_name'] = 'Distro';
    $post['distro_desc'] = 'Description of Distro';
    $post['distro_logo	'] = 'www.logourl-in-png.com';
    $post['distro_screenshot'] = 'www.screenshoturl-in-png.com';

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

    print_r($output);
?>

Returns:

Array
(
    [title] => Virtualizor
    [done] => 1
    [distros] => Array
        (
            [centos] => Array
                (
                    [distro] => centos
                    [name] => CentOS
                    [logo] => 
                    [screenshot] => 
                    [desc] => CentOS is an Enterprise-class Linux Distribution derived from sources freely provided to the public by a prominent North American Enterprise Linux vendor. CentOS conforms fully with the upstream vendors redistribution policy and aims to be 100% binary compatible. CentOS mainly changes packages to remove upstream vendor branding and artwork. CentOS is developed by a small but growing team of core developers. CentOS is free.
                    [permanent] => 1
                )

            [fedora] => Array
                (
                    [distro] => fedora
                    [name] => Fedora
                    [logo] => 
                    [screenshot] => 
                    [desc] => Fedora is a Linux-based operating system that showcases the latest in free and open source software. Fedora is always free for anyone to use, modify, and distribute. It is built by people across the globe who work together as a community: the Fedora Project. The Fedora Project is open and anyone is welcome to join. The Fedora Project is out front for you, leading the advancement of free, open software and content.
                    [permanent] => 1
                )
        )

    [timenow] => 1431508826
    [time_taken] => 0.156
)