Restore databases

This function restores a database's backup files.

Important:

When the MySQL Client role is disabled, the system also disables this function.

Note:

You must pass either the file or backup parameter.

SecurityBasicAuth
Request
query Parameters
backup
string

The database backup file to restore.

Important:

Only pass this parameter to restore files already on the server.

Note:

To restore multiple database backup files, increment the parameter name. For example: backup-1, backup-2, and backup-3.

Examples:
backup=backup-1=home/user/user_db1.sql.gz backup-2=home/user/user_db2.sql.gz backup-3=home/user/user_db3.sql.gz
backup=home/user/user_db1.sql.gz
timeout
integer >= 0
Default: 7200

The maximum number of seconds to try to restore the file.

  • 0 - The system will not time out the file restoration.
Example: timeout=3600
verbose
integer
Default: 0

Whether to return additional information from the /usr/local/cpanel/logs/cpbackup log file.

  • 1 - Return additional information.
  • 0 - Do not return additional information.
Enum: 0 1
Example: verbose=1
Request Body schema: multipart/form-data

The database backup file to upload and restore.

Important:

  • Only pass this parameter to upload files that don't already exist on the server.
  • You can not pass this parameter on the command line.

Note:

  • To upload multiple database backup files, increment the parameter name. For example: file-1, file-2, and file-3.
  • Pass this file in a multipart/form-data structure.
  • For more information about this structure, read Mozilla's POST Method documentation.
file
string <binary>
Responses
200

HTTP Request was successful.

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object
post/Backup/restore_databases
Request samples
uapi --input=json --output=jsonpretty \
  --user=username \
  Backup \
  restore_databases
Response samples
application/json
{
  • "apiversion": 3,
  • "func": "restore_databases",
  • "module": "Backup",
  • "result": {
    • "data": {
      • "log_id": "2019-08-13T15:10:07Z.1",
      • "log_path": "/home/cptest/logs/restoredb/2019-08-13T15:10:07Z.1.log",
      • "messages": [
        • "The system successfully restored the database 'user_db1' from the backup file 'user_db1.sql.gz'"
        ]
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}