GET Bucket policy

Last updated: 2021-08-30 14:39:10

    Overview

    This API is used to read the permission policy of a bucket.

    API Explorer is recommended.
    Debug
    API Explorer makes it easy to make online API calls, verify signatures, generate SDK code, search for APIs, etc. You can also use it to query the content of each request as well as its response.

    Request

    Sample request

    GET /?policy HTTP/1.1
    Host:<BucketName-APPID>.cos.<Region>.myqcloud.com
    Date:date
    Authorization: Auth String
    
    Note:

    Request headers

    This API only uses Common Request Headers.

    Request body

    The request body of this request is empty.

    Response

    Response headers

    This API only returns Common Response Headers.

    Response body

    The permission policy is returned in the response body.

    {
    "Statement": [
      {
        "Principal": {
          "qcs": [
            "qcs::cam::uin/100000000001:uin/100000000001"
          ]
        },
        "Effect": "allow",
        "Action": [
          "name/cos:GetBucket"
        ],
        "Resource": [
          "qcs::cos:ap-guangzhou:uid/1250000000:examplebucket-1250000000/*"
        ]
      }
    ],
    "version": "2.0"
    }
    

    Error codes

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

    Sample

    Request

    GET /?policy HTTP/1.1
    Host:examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com
    Authorization:q-sign-algorithm=sha1&q-ak=AKIDWtTCBYjM5OwLB9CAwA1Qb2ThTSUj****&q-sign-time=1484814099;32557710099&q-key-time=1484814099;32557710099&q-header-list=host&q-url-param-list=policy&q-signature=0523d7c6305b6676611c44798d2c48b659e6****
    

    Response

    HTTP/1.1 200 OK
    Content-Type: application/xml
    Content-Length: 237
    Connection: keep-alive
    Date: Thu Jan 19 16:21:46 2017
    Server: tencent-cos
    x-cos-request-id: NTg4MDc3MWFfOWIxZjRlXzZmNDVf****
    {
    "Statement": [
      {
        "Principal": {
          "qcs": [
            "qcs::cam::uin/100000000001:uin/100000000001"
          ]
        },
        "Effect": "allow",
        "Action": [
          "name/cos:GetBucket"
        ],
        "Resource": [
          "qcs::cos:ap-guangzhou:uid/1250000000:examplebucket-1250000000/*"
        ]
      }
    ],
    "version": "2.0"
    }