Child pages
  • UAPI Functions - WordPressBackup::get_available_backups
Skip to end of metadata
Go to start of metadata

Description

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

Note:

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

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/WordPressBackup/get_available_backups?site=example.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$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'
    )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
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'
	}
);


Note:

For more information, read our Guide to the LiveAPI System.

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


Note:

For more information, read our Guide to Template Toolkit documentation. 

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


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
	"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"
		}]
	}
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

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.
 Click to expand...

/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.
 Click to expand...

/home/example/wordpress-backups