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
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | ostemplates | The action will return the done as the array of deleted IDs | Yes |
delete | GET/POST | Int | The ID of the template to be deleted. For deleting multiple OSes, pass in the OS IDs as comma separated values | Yes |
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"
}
}
}