cPanel/Restore
cPanel module

Restore

4 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="Restore", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

directory_listing GET#

Return backups in home directory

This function lists all of the backup files and directories in the user's home directory.

Important:

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

pathstringRequired
A path to a subdirectory within the user's home directory, or any level below it. Note: The value of this parameter must begin and end with a forward slash (/) for security purposes.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

conflictinteger
Whether a difference exists between the type and onDiskType returns. 1 - Conflict exists. 0 - No conflict exists.
One of: 0 1
existsinteger
Whether the file exists in the user's directory or only in the backup. 1 - File exists in the user's directory. 0 - File exists only in the backup.
One of: 0 1
namestring
The name of the file or directory.
onDiskTypestring
The item type stored on the disk. dir - A directory. file - A file. symlink - A symlink. unknown - An unknown file type.
One of: dir file symlink unknown
typestring
The item type stored in the backup. dir - A directory. file - A file. symlink - A symlink. unknown - An unknown file type.
One of: dir file symlink unknown

get_users GET#

Return cPanel accounts with backup metadata

This function lists a reseller's users that have existing backup metadata.

Note:

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

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

An array of reseller account names.

query_file_info GET#

Return backup storage locations

This function lists all of an item's backup locations. An item can be a file, a directory, or a symlink.

Important:

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

pathstringRequired
A file, directory, or symlink in the user's directory tree. Note: The value of this parameter must begin with a forward slash (/).
existsintegerOptional
Whether to show the exist return, which indicates whether the item exists in the local disk or only in the backup. 1 — Show the exist return's value. 0 — Do not show the exists return's value.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

backupDatestring
The date when the system created the backup.
backupIDstring
The backup's identification. A date, in YYYY-MM-DD format. incremental — An incremental daily backup. The backup frequency (weekly or monthly) , a slash character (/), and the value incremental. The backup frequency (weekly or monthly), a slash character (/), and the backup date, in YYYY-MM-DD format.
backupTypestring
The backup type. compressed — A compressed tar file. incremental — A full tree of files and directories. * uncompressed — An uncompressed tar file.
One of: compressed incremental uncompressed
existsinteger
Whether the item (a file, a directory, or a symlink) exists in the local disk or only in the backup. 1 — The item exists in the local disk. 0 — The item exists only in the backup. Note: This return appears only if you set the exists parameter to 1.
One of: 1 0
fileSizeinteger
The size, in bytes, of the file in the backup. Note: The function returns this value only if the item is a file.
mtimeinteger
The file's last modification time.
pathstring
The identical file path value that the system passed in the function.
typestring
The item type stored in the backup. dir — A directory. file — A file. symlink — A symlink. unknown — An unknown file type.
One of: dir file symlink unknown

restore_file GET#

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.

backupIDmixedRequired
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.
overwriteintegerRequired
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.
pathstringRequired
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.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

successinteger
Whether the overwrite parameter succeeded. 1 — Success. 0 — Failure.
One of: 1 0