< Previous | Contents | Next >

Example 2: Adding an ACL to an object by using an ACL request body

Here’s a sample PUT request that uses an ACL request body to add an ACL to the object named mktg/budget_proposals/BudgProp-2013. The ACL grants read access to all authenticated users and full control user pblack. It makes no change to the object owner. The ACL request body is in a file named acl-3.xml.

Request body

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">



<Grantee xsi:type="Group" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<URI>http://acs.amazonaws.com/groups/global/ AuthenticatedUsers</URI>





<Grantee xsi:type="CanonicalUser" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">







Request with s3curl command line

./s3curl.pl --id=lgreen --put=acl-3.xml -- -k "https://finance.europe.hcp.example.com/mktg/budget_proposals/ BudgProp-2013?acl"

Request headers

PUT /mktg/budget_proposals/BudgProp-2013?acl HTTP/1.1 Host: finance.europe.hcp.example.com

Date: Fri, 05 Apr 2013 13:39:05 +0000

Authorization: AWS bGdyZWVu:mRqVstjwWxvfEFr8JajjrPcd8eY= Content-Length: 632

Chapter 6: Working with objects 153

Retrieving the ACL for an object

Response headers

HTTP/1.1 200 OK

Date: Fri, 05 Apr 2013 13:39:04 GMT Server: HCP V7.0.0.16

Content-Length: 0