Self Help Documentation
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
Field | Type | Required | Description |
---|---|---|---|
token | string | Yes | Authorizing API token – check API Basics for more information. |
accountuser | string | Yes | The SPanel user account that is being managed or viewed. |
action | string | Yes | The category and function being executed. |
exclude | string|array | No | Default: 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. |
ftp | bool | No | Default: false. If set to true, the backup will be uploaded to a remote FTP server using the parameters below. |
ftpserver | string | No | Required if ‘ftp’ parameter is true. The remote FTP server host for the backup to be uploaded. |
ftpusername | string | No | Required if ‘ftp’ parameter is true. The remote FTP server’s username for the backup to be uploaded. |
ftppassword | string | No | Required if ‘ftp’ parameter is true. The remote FTP server’s username authorization password for the backup to be uploaded. |
ftpemail | string | No | Required 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)