Obtains the versioning state of a specified bucket.

Request syntax

GET /?versioning HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Response elements

Element Type Description
VersioningConfiguration Container

Indicates the container used to store the versioning state of the bucket.

Sub-node: Status

Parent node: None

Status String

Indicates the versioning state of the bucket.

Parent node: VersioningConfiguration

Values:
  • Enabled: Indicates that versioning is enabled for the bucket.
  • Suspended: Indicates that versioning is suspended for the bucket.
Note If versioning has not been enabled for the requested bucket, Status is not included in the responded XML.

Examples

Request example:
GET /?versioning HTTP/1.1
Host: bucket-versioning.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 09 Apr 2019 02:28:18 GMT
Authorization: OSS pu4kyewh6qk6nut:2TeHBmWY36GwdwS0JFiRb+NV****
Response example:
  • If versioning is enabled for the bucket, the response example is as follows:
    HTTP/1.1 200 OK
    x-oss-request-id: 5CAC0342B7AEADE01700****
    Date: Tue, 09 Apr 2019 02:28:18 GMT 
    Content-Length: 121
    Content-Type: application/xml
    Connection: keep-alive
    Server: AliyunOSS
    <?xml version="1.0" encoding="UTF-8"?>
    <VersioningConfiguration>
        <Status>Enabled</Status>
    </VersioningConfiguration>
  • If versioning has not been enabled for the bucket, the response example is as follows:
    HTTP/1.1 200 OK
    x-oss-request-id: 5CAC015CB7AEADE01700****
    Date: Tue, 09 Apr 2019 02:20:12 GMT 
    Content-Length: 74
    Content-Type: application/xml
    Connection: keep-alive
    Server: AliyunOSS
    <VersioningConfiguration xmlns="http://doc.oss-cn-hangzhou.aliyuncs.com"/>
Error code HTTP status code Description
AccessDenied 403 You do not have the permission to perform this operation. Only the owner of a bucket can obtain the versioning status of the bucket.
NoSuchBucket 404 The target bucket does not exist.