GetBucketPolicy用于获取指定存储空间(Bucket)的权限策略(Policy)。

请求语法

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

当您在OSS ON云盒中调用该接口时,您需要将Host替换为云盒Endpoint。更多信息,请参见云盒Endpoint

请求头

此接口仅涉及公共请求头。更多信息,请参见公共请求头(Common Request Headers)

响应头

此接口仅涉及公共响应头。更多信息,请参见公共响应头(Common Response Headers)

示例

  • 请求示例
    GET /?policy
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Tue, 13 Nov 2018 09:09:13 GMT
    Authorization: OSS xxxxxxxxx:xxxxxxxxxxx
  • 返回示例
    200 (OK)
    server: AliyunOSS
    x-oss-server-time: 24
    connection: keep-alive
    x-oss-request-id: 5C6E9847BE0EBCD13DA90C11
    date: Thu, 21 Feb 2019 12:23:35 GMT
    content-type: application/json
    {
      "Version":"1",
      "Statement":[
        {
          "Action":[
            "oss:PutObject",
            "oss:GetObject"
          ],
          "Effect":"Deny",
          "Principal":["1234567890"],
          "Resource":["acs:oss:*:1234567890:*/*"]
        }
      ]
    }

错误码

错误码 HTTP状态码 描述
NoSuchBucketPolicy 404 请求的Bucket没有配置权限策略(Policy)。