Restore folder
Restore a folder and its children from the deleted state. Major version will be incremented for restore folder operation.
The restore location can be specified in the request body. If the request body is empty, the folder will be restored to its original location. The folder will be removed from the trash after the restore operation is completed. The restore operation is immediate and the response contains the updated folder metadata. The Location header will contain the URL of the restore job.
The restore folder operation is designed to restore a folder and its children from the deleted state to their original location. However, there are two potential conflicts that may arise. First, another folder may have been created with the same name after the original was deleted. Second, the original location may no longer exist. In such cases, the user can resolve the conflict by providing a new name for the restored folder or specifying a new location for the folder to be restored to.
Prerequisites
Section titled “Prerequisites”- A folder should be in soft deleted state. To know more about deleting a folder refer here
- Target parent folder should be created in case of conflict. To know more about creating a folder refer here
Request
Section titled “Request”POST {baseUrl}/spaces/{spaceId}/folders/{folderId}/restore-
HEADER:
- Authorization:
Bearer {tid token}
- Authorization:
Response
Section titled “Response”It will restore the source folder synchronously and sub folders will be restored asynchronously and job id will be returned in location header. Using that job id we can check restoration status.
Response Headers:
Location: /jobs/d5fdc7b4-5ddd-44f0-8129-7596895c6fa6Restore Folder in different location
Section titled “Restore Folder in different location”In case of conflict if user wants to restore the deleted folder in different location with different name, user can provide those details.
Request
Section titled “Request”POST {baseUrl}/spaces/{spaceId}/folders/{folderId}/restore-
HEADER:
- Authorization:
Bearer {tid token}
- Authorization:
-
BODY:
name- name of file to be restoredtargetParentId- target where the source file need to be restored
{"name": "new_name","targetParentId": "6529d0b3-5856-41ab-88b3-86f7955cddf1"}
Response
Section titled “Response”It will restore the source folder synchronously and sub folders will be restored asynchronously and job id will be returned in location header. Using that job id we can check restoration status.
Response Headers:
Location: /jobs/d5fdc7b4-5ddd-44f0-8129-7596895c6fa6To know more about the Restore folder API refer here.