Delete VPS Backup

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

NameMethodValueDescriptionRequired
actGETvpsrestoreThe action will return the “delete_done” as “true” on successYes
deletePOSTtextThe name of the backup fileYes
dirPOSTtextThe directory where the backup file is presentYes
datePOSTIntThe date at which the backup was taken should be in the format YYYYMMDDYes
bidPOSTIntThe backup plan ID should be specified if the backup is done on a remote serverNo

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"
}
Was this helpful to you?