Restore file or directory

This function restores a file or directory from a backup to the file or directory's original location.

Important:

When you disable the File Storage role, the system disables this function.

SecurityBasicAuth
Request
query Parameters
required
string or string or string or string

The backup's identification.

  • YYYY-MM-DD — Restore a daily backup from the specified backup date.
  • incremental — Restore a daily incremental backup.
  • weekly/YYYY-MM-DD — Restore a weekly backup from the specified backup date.
  • monthly/YYYY-MM-DD — Restore a monthly backup from the specified backup date.
  • weekly/incremental — Restore a weekly incremental backup.
  • monthly/incremental — Restore a monthly incremental backup.
Example: backupID=weekly/2017-07-03
overwrite
required
integer

Whether to overwrite the file or directory on the disc with its backup replacement.

  • 1 — Overwrite the file or directory.
  • 0 — Do not overwrite the file or directory.
Enum: 1 0
Example: overwrite=1
path
required
string <path>

The absolute file or directory's path, within a backup, that you wish to restore.

Important:

  • The value of this parameter must begin with a forward slash (/).
  • You must parse filenames properly to prevent a cross-site scripting (XSS) attack.
Example: path=/public_html/index.php
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
get/Restore/restore_file
Request samples
uapi --output=jsonpretty \
  --user=username \
  Restore \
  restore_file \
  backupID='weekly/2017-07-03' \
  path='/public_html/index.php' \
  overwrite='1'
Response samples
application/json
{
  • "apiversion": 3,
  • "func": "restore_file",
  • "module": "Restore",
  • "result": {
    • "data": {
      • "success": 1
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}