All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Get Bucket Policy

Last updated:2021-09-14 16:18:03

Description

This GET interface can get the BucketPolicy configuration of a Bucket. If you want to use this interface, you need to be the owner of this Bucket. If the interface is called successfully, it will return 200 and the configuration information of BucketPolicy; if you do not have permission to obtain BucketPolicy, it will return 403 Access Denied; if there is no BucketPolicy configuration, it will return 404 Policy Not Found.

Request

Grammar

GET /?policy HTTP/1.1
Host: {BucketName}.{endpoint}
Date: {date}
Authorization: {SignatureValue}

Note:

Request parameters

The interface does not use request parameters.

Request header

This interface only uses common request headers. For more information, please click Public request headers

Request content

A JSON string describing the bucket policy.

Response header

This interface can use all common response headers. For more information, please click Public response headers.

Response content

Bucketpolicy configuration information, string in JSON format.

Special errors

The interface does not return any special errors.

Example

Request example

GET http://ks3-example.ks3-cn-beijing.ksyuncs.com/?policy HTTP/1.1
Host: ks3-cn-beijing.ksyun.com
Authorization: authorization string
Date: Tue, 19 Jul 2016 09:12:54 GMT

Response example

When a Bucket Policy exists:

HTTP/1.1 200 OK
Content-Length: 232
Content-Type: application/json; charset=UTF-8
Date: Tue, 19 Jul 2016 09:25:29 GMT
Server: Tengine
X-Kss-Request-Id: 708e01a0b42642cd94611f33a2a96874
{"Version":"2008-10-17","Statement":[{"Sid":"1","Effect":"Allow","Principal":{"KSC":["krn:ksc:iam::{userid}:root"
]},"Action":["ks3:PutObject"],"Resource":["krn:ksc:ks3:::ks3-example/*","krn:ksc:ks3:::ks3-example"]}]}

When Bucket Policy does not exist:

HTTP/1.1 404 Not Found
Content-Type: application/xml
Date: Tue, 19 Jul 2016 09:28:59 GMT
Server: Tengine
X-Kss-Request-Id: 1f807bb266854e4487ce27857001ba38
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Error><Code>NoSuchBucketPolicy</Code>
<Message>The bucket policy does not exist.</Message><Resource>/ks3-example/?policy</Resource>
<RequestId>1f807bb266854e4487ce27857001ba38</RequestId></Error>
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback