tencent cloud

Cloud Object Storage

GET Bucket policy

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-05-21 16:04:03

Feature Description

The GET Bucket policy API is used to read the permission policy of a bucket.


Authorization Description

In the authorization policy, set the action to cos:GetBucketPolicy. View all actions.

Request

Request Example

GET /?policy HTTP/1.1
Host:<BucketName-APPID>.cos.<Region>.myqcloud.com
Date:date
Authorization: Auth String
Note:
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com. Here, <BucketName-APPID> is the bucket name with the APPID suffix, for example, examplebucket-1250000000. For details, see the Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions documents. <Region> is the available region of COS. For details, see the Regions and Access Domains document.
Authorization: Auth String (For details, see Request Signature).

Request Header

This API only uses common request headers. For details, see Common Request Headers.

Request Body

The request body of this request is empty.

Response

Response Headers

This API only returns common response headers. For details, see 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/*"
],
"Sid":"policy01"
}
],
"version": "2.0"
}
The detailed node descriptions are as follows:
Name
Parent Node
Description
Type
Sid
None
Policy Id.
String
For more information about the elements in an access policy, see Access Policy Language Overview.

Error Codes

This API follows unified error responses and error codes. For details, see Error Codes.

Practical Case

Request

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

Response

HTTP/1.1 200 OK
Content-Type: application/json
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/*"
],
"Sid":"policy01"
}
],
"version": "2.0"
}


Ajuda e Suporte

Esta página foi útil?

comentários