Use the Delete VPS Backup API to delete the backup image of the VPS. This will delete the backup file from the backup directory which is specified in the backup plan. You can use the Backup VPS Details API to get the backup information of the VPS. The API response will contain "done" as "true" after the backup file is successfully deleted.
HTTP Request
https://hostname:4085/index.php?act=vpsrestore
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | vpsrestore | The action will return the "delete_done" as "true" on success | Yes |
delete | POST | text | The name of the backup file | Yes |
dir | POST | text | The directory where the backup file is present | Yes |
date | POST | Int | The date at which the backup was taken should be in the format YYYYMMDD | Yes |
bid | POST | Int | The backup plan ID should be specified if the backup is done on a remote server | No |
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'] = '79.img';
$post['dir'] = '/tmp/api_backup';
$post['date'] = 20180918;
$output = $admin->deletevpsbackup($post);
print_r(json_encode($output));
?>
Output
{
"title": "Restore VPS Backups",
"delete_done": true,
"timenow": 1537296233,
"time_taken": "0.285"
}