Edit Distro

Use the Edit Distro API to update the distro information on the server. This is the information about the distribution flavor of the OS that will be used for the creation of Virtual Private Servers. By default Virtualizor provides information about eight types of distributions viz. CentOS, Fedora, openSUSE, Debian, Ubuntu, Scientific, Windows and Webuzo. In addition to that you can add information about any new distros also. The API response will contain “done” as “1” on successful update of the distribution information.

HTTP Request

https://hostname:4085/index.php?act=add_distro&edit=DISTRO

Parameters

NameMethodValueDescriptionRequired
actGETadd_distroThe action will return the distro after performing specific actionYes
editGETtextThe distro that needs to be edited, assign the value which is given under “Distro”Yes
distro_namePOSTtextThe distro name that needs to be editedYes
distro_descPOSTtextDescription of the distroNo
distro_logoPOSTtextUrl of Logo of the distroNo
distro_screenshotPOSTtextURL Screenshot of the distroNo

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['edit'] = 'test_distro';
    $post['distro_name'] = 'Test-api-distro';
    $post['distro_desc'] = 'This is a test distro for api';

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

    print_r(json_encode($output));

?>

Output

{
    "title": "Virtualizor",
    "done": 1,
    "distros": {
        "centos": {
            "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           merican Enterprise Linux vendor.\n
                \n
                \nCentOS 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.  \n
                \n
                \nCentOS is developed by a small but growing team of core developers. CentOS is free.",
                            "permanent": 1
        },
        "webuzo": {
            "distro": "webuzo",
            "name": "Webuzo",
            "logo": "",
            "screenshot": "",
            "desc": "Webuzo is a Single User Control panel which helps users deploy Web Apps (WordPress, Joomla, Drupal, etc) or System Apps (Apache, NGINX, PHP, Java, MongoDB, etc) on their Virtual Private Servers or in the Cloud. Webuzo enables you to focus more on using applications rather than maintaining them. Webuzo is also available in the form of Virtual Appliances.",
            "permanent": 1
        },
        "test": {
            "distro": "test",
            "name": "Test name",
            "desc": "",
            "logo": "",
            "screenshot": ""
        },
        "test_distro": {
            "distro": "test_distro",
            "name": "Test-api-distro",
            "desc": "This is a test distro for api",
            "logo": "",
            "screenshot": ""
        }
    },
    "timenow": 1536091453,
    "time_taken": "0.218"
}
Was this helpful to you?