Self Help Documentation
< All Topics

file/generatefullbackup

Description

Generates a new full backup in the selected SPanel user account. The newly created backup is placed in the specified user account’s home directory.

TThe backup can be uploaded to a remote FTP server instead if the corresponding option is selected and the necessary credentials are fulfilled.

Parameters

FieldTypeRequiredDescription
tokenstringYesAuthorizing API token – check API Basics for more information.
accountuserstringYesThe SPanel user account that is being managed or viewed.
actionstringYesThe category and function being executed.
excludestring|arrayNoDefault: empty (null). If specified, certain portions will be excluded from the backup. Possible values: ‘files_and_emails’, ‘databases’. String is accepted if you want to exclude only one type. If you want to exclude both, you must use an array.
ftpboolNoDefault: false. If set to true, the backup will be uploaded to a remote FTP server using the parameters below.
ftpserverstringNoRequired if ‘ftp’ parameter is true. The remote FTP server host for the backup to be uploaded.
ftpusernamestringNoRequired if ‘ftp’ parameter is true. The remote FTP server’s username for the backup to be uploaded.
ftppasswordstringNoRequired if ‘ftp’ parameter is true. The remote FTP server’s username authorization password for the backup to be uploaded.
ftpemailstringNoRequired if ‘ftp’ parameter is true. An e-mail address which will receive the FTP upload status after the operation is complete.

Example

$endpointUrl = 'https://123.123.123.123/spanel/api.php';

$postData = [
  'token' => 'provided_auth_token',
  'accountuser' => 'spanelio',
  'action' => 'file/generatefullbackup',
//'exclude' => ['files_and_emails', 'databases'],
//'ftp' => true,
//'ftpserver' => '123.123.123.123',
//'ftpusername' => 'ftpuser',
//'ftppassword' => 'ftppassword',
//'ftpemail' => '[email protected]'
];

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $endpointUrl);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_POST, true);
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false);
$jsonOutput = curl_exec( $ch );Code language: PHP (php)

You can find more information about the Endpoint URL in our API Basics article.

Output

{
    "result": "success",
    "data": {
        "subMessage": "Generate Backup",
        "message": "Starting...",
        "status": "inprogress"
    }
}Code language: JSON / JSON with Comments (json)
Table of Contents