All Products
Search
Document Center

Object Storage Service:GetBucketPolicy

Last Updated:Apr 28, 2024

You can call GetBucketPolicy to query the policies configured for a specified bucket.

Request syntax

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

Examples

  • Sample requests

    GET /? policy
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Tue, 13 Nov 2018 09:09:13 GMT
    Authorization: OSS qn6q**************:77Dv****************
  • Sample responses

    HTTP/1.1 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:*/*"]
        }
      ]
    }

Error codes

Error code

HTTP status code

Description

NoSuchBucketPolicy

404

No policy is configured for the requested bucket.