Child pages
  • UAPI Functions - Backup::fullbackup_to_ftp
Skip to end of metadata
Go to start of metadata

Description

This function creates a full backup via FTP to a remote server. The system creates a file in the backup-MM.DD.YYYY_HH-MM-SS_$username.tar.gz filename format, where username represent's the user's account name.

Example


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Backup/fullbackup_to_ftp?variant=active&username=username&password=luggage123456&host=example.com&port=21&directory=%2Fpublic_ftp&email=username%40example.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.

// Perform a full backup of the account's files via FTP.
$fullbackup = $cpanel->uapi(
	'Backup', 'fullbackup_to_ftp',
	array(
		'variant'		=> 'active',
		'username'		=> 'username',
		'password'		=> 'luggage123456',
		'host'			=> 'example.com',
		'port'			=> '21',
		'directory'		=> '/public_ftp',
		'email'			=> 'username@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.
 
# Perform a full backup of an account's files via FTP.
my $Backup_fullbackup = $cpliveapi->uapi(
    'Backup', 'fullbackup_to_ftp',
	{
		'variant'		=> 'active',
		'username'		=> 'username',
		'password'		=> 'luggage123456',
		'host'			=> 'example.com',
		'port'			=> '21',
		'directory'		=> '/public_ftp',
		'email'			=> 'username@example.com',
	}
);


Note:

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

 cPanel Template Toolkit
<!-- Perform a full backup of an account's files via FTP. -->
[%execute('Backup', 'fullbackup_to_ftp', { 'variant' => 'active', 'username' => 'username', 'password' => 'luggage123456', 'host' => 'example.com', 'directory' => '/public_ftp', 'port' => '21', 'email' => 'username@example.com',} ) %]


Note:

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

 Command Line
uapi --user=username Backup fullbackup_to_ftp variant=active username=username password=luggage123456 host=example.com directory=/public_ftp port=21 email=username@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)
{
   "apiversion":3,
   "module":"Backup",
   "func":"fullbackup_to_ftp",
   "result":{
      "warnings":null,
      "errors":null,
      "metadata":{
 
      },
      "status":1,
      "data":{
         "pid":"2857"
      },
      "messages":null
   }
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
variantstring

Whether to use the active or passive FTP variant to connect to the remote server.

For more information about FTP variants, read our How to Enable FTP Passive Mode documentation.

This value defaults to active.

  • active — The FTP server responds to the connection attempt and returns a connection request from a different port to the FTP client.
  • passive — The FTP client initiates connection attempts.
active
usernamestring

Required

The remote server account's username.

A valid remote server username.username
passwordstring

Required

The remote server account's password.

A valid remote server password.luggage123456
hoststring

Required

The remote server's hostname or IP address.

A valid hostname or IP address.example.com
directory string

The directory on the remote server that will store the backup.

This value defaults to the remote server account's default login directory.

A valid directory.

Important:

Enter the directory relative to the FTP user's login directory. For example, enter /public_ftp not /home/username/ public_ftp.

/public_ftp
portinteger
The port number to use during the transfer.
This value defaults to 21.

A valid port number.

 21
emailstring

The email address to receive a confirmation email when the backup completes.

Note:

The system does not provide confirmation if you do not pass this parameter.

This value defaults to undef.

A valid email address.username@example.com

Returns

ReturnTypeDescriptionPossible valuesExample
pidstringThe backup's process identifier.A valid PID.2857