This API is used to create a bucket under a specified account. A signature needs to be carried in Authorization
and anonymous calls are not supported. By default, the bucket creator is the bucket owner.
Note:
- If no access permission is specified for a bucket when it is created,
private
(private read/write) will be used by default.
Sample 1
PUT / HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-Length: 0
Authorization: Auth String
Sample 2
PUT / HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-Type: application/xml
Content-Length: Content Length
Content-MD5: MD5
Authorization: Auth String
[Request Body]
Note:
- In
Host: <bucketname-appid>.cos.<region>.myqcloud.com
,is the bucket name followed by the APPID, such as examplebucket-1250000000
(see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), andis a COS region (see Regions and Access Endpoints). - Authorization: Auth String (See Request Signature for details.)
This API has no request parameter.
In addition to common request headers, this API also supports the following request headers. For more information about common request headers, please see Common Request Headers.
Header | Description | Type | Required |
---|---|---|---|
x-cos-acl | Defines the access control list (ACL) attribute of the bucket. For the enumerated values such as private (default) and public-read , please see the Preset ACL section in ACL Overview. |
Enum | No |
x-cos-grant-read | Grants a user permission to read the bucket in the format of id="[OwnerUin]" (e.g., id="100000000001" ). You can use a comma (,) to separate multiple users, for example, id="100000000001",id="100000000002" . |
string | No |
x-cos-grant-write | Grants a user permission to write to the bucket in the format of id="[OwnerUin]" (e.g., id="100000000001" ). You can use a comma (,) to separate multiple users, for example, id="100000000001",id="100000000002" . |
string | No |
x-cos-grant-read-acp | Grants a user permission to read the ACL and policies of the bucket in the format of id="[OwnerUin]" (e.g., id="100000000001" ). You can use a comma (,) to separate multiple users, for example, id="100000000001",id="100000000002" . |
string | No |
x-cos-grant-write-acp | Grants a user permission to write to the ACL and policies of a bucket in the format of id="[OwnerUin]" (e.g., id="100000000001" ). You can use a comma (,) to separate multiple users, for example, id="100000000001",id="100000000002" . |
string | No |
x-cos-grant-full-control | Grants a user full permission to operate on the bucket in the format of id="[OwnerUin]" (e.g., id="100000000001" ). You can use a comma (,) to separate multiple users, for example, id="100000000001",id="100000000002" . |
string | No |
This API only returns Common Response Headers.
The response body of this API is empty.
This API returns common error responses and error codes. For more information, please see Error Codes.
PUT / HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Sun, 26 May 2019 14:51:38 GMT
Content-Length: 0
Authorization: q-sign-algorithm=sha1&q-ak=AKID8A0fBVtYFrNm02oY1g1JQQF0c3JO****&q-sign-time=1558882298;1558889498&q-key-time=1558882298;1558889498&q-header-list=content-length;date;host&q-url-param-list=&q-signature=c25fd640274a6da2318935ceebfbcfba4598****
Connection: close
HTTP/1.1 200 OK
Content-Length: 0
Connection: close
Date: Sun, 26 May 2019 14:51:37 GMT
Server: tencent-cos
x-cos-request-id: NWNlYWE3ZjlfZDQyNzVkNjRfMzg1N18yNzFh****
public-read
and granting a user permissions to write to the bucket and read the bucket ACL and policiesPUT / HTTP/1.1
Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.com
Date: Fri, 14 Jun 2019 13:48:59 GMT
x-cos-acl: public-read
x-cos-grant-write: id="100000000002"
x-cos-grant-read-acp: id="100000000002"
Content-Length: 0
Authorization: q-sign-algorithm=sha1&q-ak=AKID8A0fBVtYFrNm02oY1g1JQQF0c3JO****&q-sign-time=1560520139;1560527339&q-key-time=1560520139;1560527339&q-header-list=content-length;date;host;x-cos-acl;x-cos-grant-read-acp;x-cos-grant-write&q-url-param-list=&q-signature=df03e7917270e0bf2b679bc6f99793bd0c63****
Connection: close
HTTP/1.1 200 OK
Content-Length: 0
Connection: close
Date: Fri, 14 Jun 2019 13:49:00 GMT
Server: tencent-cos
x-cos-request-id: NWQwM2E1Y2NfZjBhODBiMDlfOTM1YV83NDRi****
Was this page helpful?