PutBucketVersioning
Updated at:2025-11-03
API description
Use the PutBucketVersioning API to set the version control status of a specified bucket.
Note
- To set up version control, you must have PutBucketVersioning permissions.
- A bucket can have one of three version statuses: not enabled, enabled, or suspended. By default, the version status is not enabled.
- When the bucket is in the "enabled" version status, all newly added files (objects) will have unique version IDs, creating multiple versions of the object.
- When the bucket is in the "suspended" version status, the version ID of newly added objects becomes null, and no additional versions will be generated under this status.
Request
JSON
1PUT /?versioning HTTP/1.1
2Host: <BucketName>.bj.bcebos.com
3x-bce-date: <Date>
4Content-Length: <ContentLength>
5Content-Type:application/json; charset=utf-8
6Authorization: <AuthorizationString>
7{status:enabled}
Response
- No special header parameters returned in the response header
- Response element: None
Example
-
Example of setting multi-version status
JSON1PUT /?versionging HTTP/1.1 2Host: BucketName.bj.bcebos.com 3x-bce-date: 2024-04-06T08:23:49Z 4Content-Length : 16 5Content-Type: application/json; charset=utf-8 6Authorization: AuthorizationString 7{status:enabled} -
Response example
JSON1HTTPS/1.1 200 OK 2x-bce-request-id: 4db2b34d-654d-4d8a-b49b-3049ca786409 3Content-Length: 0 4Date: Wed, 06 Apr 2024 06:34:40 GMT 5Server: BceBos
