Restore VPS Backups

Use the Restore VPS Backups API to restore the backup of the VPS. Virtualizor allows you to restore the VPS to the original VPS or create a new VPS altogether using the backup image. To get the details of the backup directory and the date use the Backup VPS Details API. The API response will contain “restore_done” as “true” after the restoration process is initiated.

For more information, you can refer this Backup Plans guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETvpsbackupsThis action will restore the vps whose backup exists and return restore_done as trueYes
vpsidPOSTIntThe ID of vps which needs to be restoredYes
dirPOSTtextThe directory where the backup image has been savedYes
datePOSTIntThe date at which the backup was taken should be in the format YYYYMMDDYes
newvpsPOST1/0If set a new VPS will be created using the backup fileNo

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['vpsid'] = 79 ;
    $post['dir'] = '/tmp/api_backup' ;
    $post['date'] = 20180918 ;
    $post['newvps'] = 1 ; // Pass this if you want to restore to a new vps

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

    print_r(json_encode($output));
?>

Output

{
    "title": "Restore VPS Backups",
    "restore_done": true,
    "restore_details": "",
    "timenow": 1537294345,
    "time_taken": "0.244"
}
Was this helpful to you?