Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 2.34 KB

README.md

File metadata and controls

55 lines (41 loc) · 2.34 KB

php-ahsay-api-wrapper

GitHub license

GitHub release

PHP API wrapper for AhsayOBS 6 & 7

Example usage

ahsay-api-wrapper-example.php

require 'ahsay-api-wrapper.php';

const  BACKUPSERVER_ADDRESS       = 'http://ahsay.server.com';
const  BACKUPSERVER_ADMINUSER     = 'adminuser';
const  BACKUPSERVER_ADMINPASSWORD = 'password';
const  BACKUPSERVER_VERSION        = 'OBSversion';

try {
    $api = new AhsayApiWrapper(BACKUPSERVER_ADDRESS, BACKUPSERVER_ADMINUSER, BACKUPSERVER_ADMINPASSWORD, BACKUPSERVER_VERSION);

    $api->debug(true);
   
    $user = 'user01'; // Ahsay username
    $backupSet = '1317401234567'; // Ahsay numeric backupset ID

    $lastJobID = $api->getMostRecentBackupJob($user, $backupSet);
    $lastJobDetailArray = $api->getUserBackupJobDetails($user, $backupSet, $lastJobID);
    $DestinationID = $api->getDestinationID($user, $backupSet, $backupJob);

    //var_dump($api->getUser($user));
    //var_dump($api->getUSerBackupSet($user, $backupSet));
    //var_dump($api->getUserStorageStats($user, $date));
    //var_dump($api->getBackupJobsForSet($user, $backupSet));
    //var_dump($api->getBackupSetJobIds($user, $backupSet));
    //var_dump($api->listBackupJobStatus($user, $date));
    //var_dump($api->getUserBackupJobs($user));
    //var_dump($api->getMostRecentBackupJob($user, $backupset));

    printf ('DestinationID: ' . $DestinationID . "\n\r");
    printf('BackupJobStatus: '. $lastJobDetailArray->Data->BackupJobStatus . "\n");
    printf('EndTime: '. $lastJobDetailArray->Data->EndTime . "\n");

} catch (Exception $e) {
    echo $e->GetMessage();
}
?>

Known issues / limitations

Some API calls are known to be missing. You are welcome to write the code for these functions yourself and submit the necessary code to me for inclusion in future releases of this library.

License

GitHub license

See the LICENSE file for more details.