Restore files

This function restores an account's files.

Important:

When the File Storage role is disabled, the system also disables this function.

Note:

You must use the backup parameter when you call this function in one of the following formats:

  • As part of a multipart/form-data request body to upload and restore a backup file to the server. For more information about this structure, read Mozilla's POST Method documentation.
  • As a query parameter to restore an existing file on the server.
Authorizations:
query Parameters
backup
string

The backup file to restore.

Important:

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

Note:

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

Examples:
backup=backup-1=/home/cpuser/backup-cpuser.tld-9-10-2019_1.tar.gz backup-2=/home/cpuser/backup-cpuser.tld-9-10-2019_2.tar.gz
backup=/home/cpuser/backup-cpuser.tld-9-10-2019_1.tar.gz
directory
string <path>

The directory to which to restore the file. The default is the user's home directory.

Example: directory=/home/user/example
timeout
integer >= 0
Default: 172800

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

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

Whether to return additional information from the /home/cptest/.cpanel/logs/restorefiles log files.

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

The backup file to upload and restore.

Important:

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

Note:

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

backup
string <binary>

Responses

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

Request samples

uapi --input=json --output=jsonpretty \
  --user=username \
  Backup \
  restore_files

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "restore_files",
  • "module": "Backup",
  • "result": {
    • "data": {
      • "log_id": "2019-08-13T15:10:07Z.1",
      • "log_path": "/home/cptest/.cpanel/logs/restorefiles/2019-08-13T15:10:07Z.1.log",
      • "messages": [
        • "The system successfully restored the directory /home/cpuser/point2 from the backup file backup-cpuser.tld-9-10-2019_1.tar.gz"
        ]
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}