You can call this operation to query the versioning state of a 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 | The container that stores the versioning state of the bucket.
Child node: Status Parent node: none |
Status | String | The versioning state of the bucket.
Parent node: VersioningConfiguration Valid values:
|
Examples
Sample request
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****
Sample responses
- Sample response for a bucket for which versioning is enabled
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>
- Sample response for a bucket for which versioning is disabled
If versioning is disabled for the requested bucket, the versioning state of the bucket is not contained in the XML body of the response.
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"/>
SDK
You can use SDKs for the following programming languages to call the GetBucketVersioning operation:
Error codes
Error code | HTTP status code | Description |
---|---|---|
AccessDenied | 403 | The error message returned because you do not have permissions to query the versioning
state of the bucket.
Only the bucket owner or RAM users that have the GetBucketVersioning permission can query the versioning state of a bucket. |
NoSuchBucket | 404 | The error message returned because the specified bucket does not exist. |