Baidu AI Cloud
中国站

百度智能云

Object Storage

PutBucketAcl

Interface Description

This interface is used to set the access control of the bucket. At present, ACL can be set for BOS in two ways. The first one is to set ACL through “x-bce-acl" in the header field by using CannedAcl during PutBucketAcl. At present, the settable access control includes private, public-read, and public-read-write (case sensitive). The second one is to upload an ACL file. For the file format, please see [ACL File Format](BOS/API References/Access Control.md#Access Control Implemented by Uploading ACL).

Note:
The BOS system does not support the setting of the "x-bce-acl" and uploading of the ACL file in the same request.

Request

  • Request syntax

    PUT /?acl HTTP/1.1
    Host: <BucketName>.bj.bcebos.com
    x-bce-date: <Date>
    Content-Length: <ContentLength>
    Content-Type:application/json; charset=utf-8
    Authorization: <AuthorizationString>
    x-bce-acl: <ACLString>
  • Request parameters

    No special parameters.

  • Request header field

    Name Type Description Required?
    x-bce-acl String The ACL set by the bucket supports private, public-read, and public-read-write. No

Response

  • Response header field

    No special header parameters.

  • Response element

    None

Considerations

  1. Only the bucket owner and the user with the FULL_CONTROL permission can set the object ACL.
  2. The bucket ACL is set to private by default during the creation of the bucket.

Example

  • Example of using a CannedAcl request

    PUT /?acl HTTP/1.1
    Host: BucketName.bj.bcebos.com
    x-bce-date: 2016-04-06T08:23:49Z 
    Authorization: AuthorizationString
    x-bce-acl: public-read
    Content-Type: application/json; charset=utf-8
    Content-length: 0
  • Example of uploading an ACL file

    PUT /?acl HTTP/1.1
    Host: BucketName.bj.bcebos.com
    x-bce-date: 2016-04-06T08:23:49Z 
    Content-Length :1324
    Content-Type: application/json; charset=utf-8
    Authorization: AuthorizationString
    
    {
        "accessControlList":[
             { 
                   "grantee":[{
                      "id":"168bf6fd8fa74d9789f35a283a1f15e2"
                    }],
                    "permission":["READ"]
              }
         ]
    }
  • Response example

    HTTPS/1.1 200 OK
    x-bce-request-id: 4db2b34d-654d-4d8a-b49b-3049ca786409
    Content-Length: 0
    Date: Wed, 06 Apr 2016 06:34:40 GMT
    Server: BceBos
Previous
Basic Operations
Next
Compliance Retention