Description

This function retrieves a list of available WordPress® site backups of a single site.


You must install the WordPress Manager cPanel plugin to access this API function.


Examples 




https://hostname.example.com:2083/cpsess##########/execute/WordPressBackup/get_available_backups?site=example.com



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Retrieve the list of available backups for WordPress site.
 $instances = $cpanel->uapi(
    'WordPressBackup', 'get_available_backups',
array( 
        'site' => 'example.com'
    )
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Retrieve the list of available backups for WordPress site.
my $instances = $cpliveapi->uapi(
    'WordPressBackup', 'get_available_backups',
	{
		'site' => 'example.com'
	}
);



<!-- Retrieve the list of available backups for WordPress site. -->
[% data = execute( 'WordPressBackup', 'get_available_backups', { 'site' => 'example.com' } ); %]



uapi --user=username WordPressBackup get_available_backups site=example.com



{
	"metadata": {},
	"warnings": null,
	"errors": null,
	"status": 1,
	"messages": null,
	"data": {
		"dir": "/home/example/wordpress-backups",
		"available": [{
			"path": "/home/example/wordpress-backups/example.com__2018-10-10T10:53:31-0500.tar.gz",
			"file": "example.com__2018-10-10T10:53:31-0500.tar.gz",
			"site": "example.com",
			"date": "1539267197000"
		}]
	}
}



Parameters

ParameterTypeDescriptionPossible valuesExample
sitestring

Required

The WordPress site's URL.

A URL without the protocol prefix.


example.com


example.com/wordpress


Returns

ReturnTypeDescriptionPossible valuesExample
availablearray of hashesA hash that contains a list of the WordPress site's backups.This array of hash contains the date, file, path, and site returns.



date

string

The date and time the system created the backup.

This function returns this value in the available array of hashes.

A valid timestamp, in milliseconds, in Unix Epoch time.
1539267197000

file

string

The backup's file name.

This function returns this value in the available array of hashes.

A backup file with the tar.zip extension.example.com__2018-10-10T10:53:31-0500.tar.gz

path

string

The path to the backup file.

This function returns this value in the available array of hashes.

The absolute path to the file.


/home/example/wordpress-backups/example.com__2018-10-10T10:53:31-0500.tar.gz


site

string

The site's URL.

This function returns this value in the available array of hashes.

A URL without the protocol prefix.example.com
dirstringThe path to the backup directory.The absolute path to the directory.


/home/example/wordpress-backups