PutBucketTrash
Last Updated:2021-12-08
Interface Description
This interface is used to enable the Bucket Trash feature. The user must be the source bucket owner with the FULL_CONTROL permission and the destination bucket owner.
Request
-
Request syntax
PUT /?trash HTTP/1.1 Host: <BucketName>.bj.bcebos.com Date: <Date> Authorization: <AuthorizationString> Content-Type: application/json Content-Length: <ContentLength>
-
Request header field
No special header parameters.
-
Request element
Name Description trashDir Trash directory name with a length limit Optional. The default name is .trash
if it is left blank.Description:
- With the trash feature enabled, the original directory name is overwritten.
- "trashDir" can only contain letters, numbers, Chinese characters, underline (_), hyphen (-), and decimal point (.). An error occurs if it contains '/'.
- If the Trash feature is enabled for the bucket, the object deleted is put in the trash. The full name of the object in the trash is trashDir + '/' + old object name. If this feature is not enabled for the bucket, or if this feature is enabled for the bucket and the object in the trash is deleted, the object is deleted completely.
- The archive file cannot be put in the bucket trash. When you delete an archive file, it is deleted directly.
Response
-
Response header field
None
-
Response element
Results Http Status Error Code Description JSONformat error 400 MalformedJSON - Trash directory name too long 400 EntityTooLarge Not more than 1,024 bytes. The trash directory contains invalid characters. 400 InvalidTrashDirectoryName It can only contain letters, numbers, Chinese characters, underline (_), hyphen (-), and decimal point (.). The bucket does not exist. 404 NoSuchBucket - Access denied 403 AccessDenied Only the bucket owner with the FULL_CONTROL permission can operate it.
Example
-
Request example
PUT /?trash HTTP/1.1 Host: bucket.bj.bcebos.com x-bce-date: date Content-Length: request-body-length Content-Type: application/json; charset=utf-8 Authorization: AuthorizationString { "trashDir": "trashDirName" }
-
Response example
HTTP/1.1 200 OK x-bce-request-id: 4db4b34d-653d-4d9a-b49b-3049ca786409 Date: Wed, 31 May 2017 08:34:40 GMT Server: BceBos