Template Browser

Use the Template Browser API to list all the templates available for download. These are ready-made templates which can be used to create Virtual Private Servers. The API response will contain a list of array of the OS templates that are available for download with the “oses” key and the OS templates that are already downloaded with “ostemplates” key.

HTTP Request

https://hostname:4085/index.php?act=edittemplate&osid=OSID

Parameters

NameMethodValueDescriptionRequired
actGETosThe action specified to perform operation and retrieve dataYes

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

    print_r(json_encode($output));

?>

Output

{
    "title": "OS Templates Browser",
    "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"
        },
        "3": {
            "osid": "3",
            "type": "openvz",
            "name": "centos-5-x86",
            "filename": "centos-5-x86.tar.gz",
            "size": "182778727",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "0",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=3",
            "distro": "centos",
            "Nvirt": "openvz"
        },
        "4": {
            "osid": "4",
            "type": "openvz",
            "name": "centos-5-x86_64",
            "filename": "centos-5-x86_64.tar.gz",
            "size": "197978185",
            "pygrub": "0",
            "drive": "",
            "hvm": "0",
            "perf_ops": "0",
            "active": "1",
            "url": "http://files.virtualizor.com/ostemplates.php?osid=4",
            "distro": "centos",
            "Nvirt": "openvz"
        },
    "oslist": {
        "kvm": {
            "centos": {
                "100007": {
                    "type": "kvm",
                    "fstype": "ext3",
                    "url": "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso",
                    "filename": "centos-mini.iso",
                    "name": "centos-mini",
                    "size": 67108864,
                    "distro": "centos",
                    "Nvirt": "kvm"
                }
            }
        }
    },
    "ostemplates": {
        "100007": {
            "type": "kvm",
            "fstype": "ext3",
            "url": "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso",
            "filename": "centos-mini.iso",
            "name": "centos-mini",
            "size": 67108864,
            "distro": "centos",
            "Nvirt": "kvm"
        }
    },
    "timenow": 1536073735,
    "time_taken": "0.314"
}
Was this helpful to you?