tencent cloud

Feedback

PUT Bucket versioning

Last updated: 2024-03-28 18:08:33

    Overview

    This API is used to enable or suspend versioning for a bucket.
    

    Notes

    If you have never enabled versioning for the bucket, GET Bucket versioning will not return a versioning state value.
    1. Once enabled, versioning can only be suspended but cannot be disabled.
    2. Set the versioning state value to Enabled or Suspended to enable or suspend versioning, respectively.
    3. To set versioning for a bucket, you need to have the permission to write to the bucket.

    Request

    Sample request

    PUT /?versioning HTTP 1.1
    Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
    Date: GMT date
    Authorization: Auth String
    Note:
    In Host: <BucketName-APPID>.cos.<Region>.myqcloud.com, <BucketName-APPID> is the bucket name followed by the APPID, such as examplebucket-1250000000 (see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).
    Authorization: Auth String (See Request Signature for details.)

    Request headers

    This API only uses Common Request Headers.

    Request body

    <VersioningConfiguration>
    <Status></Status>
    </VersioningConfiguration>
    The nodes are described as follows:
    Node Name (Keyword)
    Parent Node
    Description
    Type
    VersioningConfiguration
    None
    Describes the detailed information on versioning
    Container
    Status
    VersioningConfiguration
    Whether to enable versioning. Valid values: Suspended, Enabled
    Enum

    Response

    Response headers

    This API only returns Common Response Headers.

    Response body

    The response body is empty.

    Error codes

    This API returns common error responses and error codes. For more information, please see Error Codes.

    Samples

    Request

    PUT /?versioning HTTP/1.1
    Host: examplebucket-1250000000.cos.ap-chengdu.myqcloud.com
    Connection: keep-alive
    Accept-Encoding: gzip, deflate
    Accept: */*
    User-Agent: python-requests/2.12.4
    Content-Type: application/xml
    Authorization: q-sign-algorithm=sha1&q-ak=AKID15IsskiBQKTZbAo6WhgcBqVls9Sm****&q-sign-time=1480932292;1981012292&q-key-time=1480932292;1981012292&q-url-param-list=versioning&q-header-list=host&q-signature=47ec2b80c73788ecd394d3b9ad90e120a32f****
    Content-Length: 83
    
    <VersioningConfiguration>
    <Status>Enabled</Status>
    </VersioningConfiguration>

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 0
    Connection: keep-alive
    Date: Wed, 23 Aug 2017 08:14:53 GMT
    Server: tencent-cos
    x-cos-request-id: NTk5ZDM5N2RfMjNiMjM1MGFfMmRiX2Y0****
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support