Use the Delete Volume API to delete the volume by passing the volume id,
The API response will contain "done" as the details of the deleted volume.
HTTP Request
https://hostname:4085/index.php?act=volumes
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | volume | The action to delete volume | Yes |
delete | POST | int | The ID of the volumes that needs to be deleted | 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'] = 2;
$post['delete'] = '3,4'; // for deleting multiple storage values
$output = $admin->delete_volumes($post);
print_r(json_encode($output));
?>
Output
Array
(
[done] => Array
(
[246] => Array
(
[did] => 246
[disk_uuid] => d98evphoc370qjph
[st_uuid] => rjpzdi7exu0njjeh
[vps_uuid] => attachable
[path] => /dev/vgs/vsv1003attach-d98evphoc370qjph-tjkgme2cjn9tgzet
[primary] => 0
[size] => 1.000
[size_unit] =>
[type] => block
[format] => raw
[num] => -1
[rescue] => 0
[extra] =>
[bus_driver] =>
[bus_driver_num] => 0
[user_uid] => 3
[disk_name] => disk_two
[mnt_point] => /root/mt
[stid] => 1
[serid] => 1
[sgid] => -2
)
)
)