PutObjectAcl
Sets the access control list (ACL) permissions for an object that already exists in a bucket.
Description
The PutObjectAcl
operation uses the acl
subresource to set the access control list (ACL) permissions for an existing object in a bucket. You must have WRITE_ACP
permission to change an object's ACL.
Permissions
You need the following permissions to use this operation:
s3:PutObjectAcl
on the objects3:PutObject
on the object if you're also the object owner
Request
Request Headers
Name | Description | Required | Type |
---|---|---|---|
x-amz-acl | Predefined ACL to apply to the object. Valid values: private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control | No | string |
Content-MD5 | Base64-encoded 128-bit MD5 digest of the data | Yes | string |
x-amz-request-payer | Confirms that the requester knows that they will be charged for the request | No | string |
x-amz-expected-bucket-owner | The account ID of the expected bucket owner | No | string |
Request URI Parameters
Name | Description | Required | Type |
---|---|---|---|
versionId | Version ID of the object that you want to set the ACL for | No | string |
Request Body
The request accepts the following XML elements:
Name | Description | Required | Type |
---|---|---|---|
AccessControlPolicy | Container for the request | Yes | XML |
Owner | Container for the bucket owner's ID and display name. See Owner for details. | No | Container |
Grants | Array of Grant data types. See Grant for details. | No | Container |
Request Syntax
PUT /ObjectKey?acl&versionId=VersionId HTTP/1.1
Host: BucketName.qstorage.quilibrium.com
x-amz-acl: private
Content-MD5: Base64EncodedMD5
Authorization: authorization string
Date: Date
x-amz-request-payer: requester
x-amz-expected-bucket-owner: OwnerAccountId
<?xml version="1.0" encoding="UTF-8"?>
<AccessControlPolicy>
<Owner>
<ID>OwnerID</ID>
<DisplayName>OwnerName</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee>
<ID>GranteeID</ID>
<DisplayName>GranteeName</DisplayName>
</Grantee>
<Permission>Permission</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Values in italics indicate user input and should be replaced with actual values.
Response
Response Headers
Name | Description | Required | Type |
---|---|---|---|
x-amz-request-charged | If present, indicates that the requester was successfully charged for the request Valid values: requester | No | String |
Response Body
This operation does not return a response body.
Response Errors
Name | Description | Required | Type |
---|---|---|---|
NoSuchKey | The specified key does not exist (HTTP Code 404) | No | Error |
Examples
Set ACL for an Object
This example sets the ACL on an object to grant full control to the owner.
Example Request
PUT /example-object?acl HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
x-amz-acl: private
Content-MD5: 6aKJsA2R/DqbxeJX7HaXzw==
Date: Wed, 28 Oct 2023 22:32:00 GMT
Authorization: authorization string
<?xml version="1.0" encoding="UTF-8"?>
<AccessControlPolicy>
<Owner>
<ID>123456789abc</ID>
<DisplayName>owner-name</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee>
<ID>123456789abc</ID>
<DisplayName>owner-name</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
Values in italics indicate user input and should be replaced with actual values.
Example Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Wed, 28 Oct 2023 22:32:00 GMT
Values in italics indicate variable response values.
Set ACL Using a Canned ACL
This example sets a predefined (canned) ACL on an object.
Example Request
PUT /example-object?acl HTTP/1.1
Host: my-bucket.qstorage.quilibrium.com
x-amz-acl: public-read
Content-MD5: 6aKJsA2R/DqbxeJX7HaXzw==
Date: Wed, 28 Oct 2023 22:32:00 GMT
Authorization: authorization string
Values in italics indicate user input and should be replaced with actual values.
Example Response
HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
Date: Wed, 28 Oct 2023 22:32:00 GMT
Values in italics indicate variable response values.