Get Virtualizor

Delete OS Templates

Use the Delete OS Templates API to delete the OS Templates from your server, by passing the OS ID. Deleting the template will remove the downloaded image from the server. This will not affect the Virtual Private Servers that are already made using the template. The API response will contain "done" as array of the deleted OS template IDs on success.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETostemplatesThe action will return the done as the array of deleted IDsYes
deleteGET/POSTIntThe ID of the template to be deleted. For deleting multiple OSes, pass in the OS IDs as comma separated valuesYes

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['delete'] = 100004;
    $post['delete'] = '100005,100006'; // for deleting multiple OS templates

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

    print_r(json_encode($output));
?>

Output


{
    "title": "OS Templates",
    "done": [
        100005,
        100006
    ],
    "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"
        }
    }
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list