OS Templates

Virtualizor provides multiple ready-made OS templates that can be used for creation of Virtual Private Servers.

Use the OS Templates API to list all the OS templates. The API response contains a list of arrays of the OS templates that are available for download with the “oses” key and the OS templates that are already downloaded with “ostemplates” key.

See also: Add OS templates guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETostemplatesThe action will return the list ostemplateYes

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);

    $output = $admin->ostemplates();

    print_r(json_encode($output));

?>

Output

{
    "title": "OS Templates",
     "oses": {
        "1": {
            "osid": "1",
            "type": "openvz",
            "name": "centos-4-x86",
            "filename": "centos-4-x86.tar.gz",
            "size": "158628685",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "0",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=1",
            "distro": "centos",
            "Nvirt": "openvz"
        },
        "2": {
            "osid": "2",
            "type": "openvz",
            "name": "centos-4-x86_64",
            "filename": "centos-4-x86_64.tar.gz",
            "size": "172018026",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "0",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=2",
            "distro": "centos",
            "Nvirt": "openvz"
        }
     },
    "oslist": {
        "vzo": {
            "centos": {
                "448": {
                    "osid": "448",
                    "type": "vzo",
                    "name": "centos-7-x86_64-minimal",
                    "filename": "centos-7-x86_64-minimal.tar.gz",
                    "size": "145762586",
                    "pygrub": "0",
                    "drive": "",
                    "hvm": "0",
                    "perf_ops": "0",
                    "active": "1",
                    "url": "http://files.virtualizor.com/ostemplates.php?osid=448",
                    "distro": "centos",
                    "Nvirt": "vzo",
                    "mg": [
                        2
                    ]
                    }
                }
            }
        },
    "ostemplates": {
        "270": {
            "osid": "270",
            "type": "kvm",
            "name": "centos-6.5-x86",
            "filename": "centos-6.5-x86.img",
            "size": "1074855936",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "1",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=270",
            "distro": "centos",
            "Nvirt": "kvm"
        },
        "100001": {
            "type": "kvm",
            "filename": "Centos7_cpanel.img",
            "name": "Centos7_cpanel",
            "url": "",
            "size": 2147483648,
            "fstype": "ext3",
            "distro": "others",
            "Nvirt": "kvm"
        }
    }
}
Was this helpful to you?