# 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.

Endpoint: GET /Restore/restore_file
Version: 11.136.0.25
Security: BasicAuth

## Query parameters:

  - `backupID` (any, required)
    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: "weekly/2017-07-03"

  - `overwrite` (integer, required)
    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

  - `path` (string, required)
    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: "/public_html/index.php"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "restore_file"

  - `module` (string)
    The name of the module called.
    Example: "Restore"

  - `result` (object)

  - `result.data` (object)
    An object containing the status of the operation.

  - `result.data.success` (integer)
    Whether the overwrite parameter succeeded.

* 1 — Success.
* 0 — Failure.
    Enum: 1, 0

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    - 1 - Success
- 0 - Failed: Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


