API Restore VPS Backup

From Virtualizor Wiki
Jump to: navigation, search
NOTE
This is OLD API Documentation. Click on the following link for New API Documentation
Admin API

Set VPS Backup Settings

Parameters Type Description
restore POST ID of the VPS to be restored
delete POST Comma Separeted VPS IDs to delete backups
date POST Backup Date in YYYYMMDD format

Example Code

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['restore'] = '1646'; // VPSID for backup to restore
    //$post['delete'] = '1646,1647'; // CSV VPSID to delete backups
    $post['date'] = '20150902';

    $output = $admin->vpsbackups($post);
    print_r($output);
?>

Returns: <syntaxhighlight lang="php"> Array (

   [title] => VPS Backups
   [backups_list] => Array
       (
           [20150902] => Array
               (
                   [0] => Array
                       (
                           [abs_path] => /test/20150902/1646.tar.gz
                           [size] => 219032163
                       )
               )
       )
   [restore_done] => 1
   [timenow] => 1441193642
   [time_taken] => 0.071

)