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.
The 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. |
type | string | No | Default: zip. Supported backup archive types: ‘zip’ or ‘tar’. |
files | array | No | Default: empty (null) – will include all files within the selected account’s home directory. Possible value: an array with existing files. |
databases | array | No | Default: empty (null) – will include all of the selected SPanel account’s databases. Possible value: an array with existing databases. |
password | string | No | Default: empty (null). If specified, the archive will be locked with a password. Note: Windows OS does not support encrypted tar archives. |
exclude | array | No | Default: empty (null). If specified, certain elements will be excluded from the backup. Possible values: ‘databases’, ‘files’, ’emails’. |
expiration | string | No | Default: empty (null). If specified, the backup archive will be deleted on a specific date. Format: d.m.Y, e.g. ‘22.12.2045’. |
description | string | No | Backup description. |
ftp | bool | No | Default: false. If set to true, the backup will be uploaded to a remote FTP server using the FTP 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. |
ftpcleanup | bool | No | Default: false. If set to true, the local backup will be deleted when the upload is complete. |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
$endpointUrl = 'https://123.123.123.123/spanel/api.php'; $postData = [ 'token' => 'provided_auth_token', 'accountuser' => 'spanelio', 'action' => 'file/generatefullbackup', //'type' => 'tar', //'password' => 'veryStrongPassword5543', //'exclude' => ['databases', 'files', 'emails'], //'expiration' => '22.12.2045', //'description' => 'Before update', //'ftp' => true, //'ftpserver' => '123.123.123.123', //'ftpusername' => 'ftpuser', //'ftppassword' => 'ftppassword', //'ftpemail' => '[email protected]', //'ftpcleanup' => true ]; $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 ); |
You can find more information about the Endpoint URL in our API Basics article.
Output
1 2 3 4 5 6 7 8 |
{ "result": "success", "data": { "subMessage": "Generate Backup", "message": "Starting...", "status": "inprogress" } } |