samedi 5 septembre 2015

Amazon S3 REST API Malformed XML Error on PutBucketLifeCycle

I am trying to do a PUT request via the REST API to establish a lifecycle rule as described here: http://ift.tt/VuItCa

But even when I PUT the exact same XML Data as in Example 1, I get a 'Malformed XML Error'. Also Content-Length and MD5 of the request in this example seem not to be valid as I calculate different values.

My put is:

PUT http://ift.tt/1KRyTQi
Content-length: 397
Content-MD5: Or7bcOqR6tcsifiqQpq1tw==
… (Signature headers etc.)

<LifecycleConfiguration>
  <Rule>
    <ID>id1</ID>
    <Prefix>documents/</Prefix>
    <Status>Enabled</Status>
    <Transition>
      <Days>30</Days>
      <StorageClass>GLACIER</StorageClass>
    </Transition>
  </Rule>
  <Rule>
    <ID>id2</ID>
    <Prefix>logs/</Prefix>
    <Status>Enabled</Status>
    <Expiration>
      <Days>365</Days>
    </Expiration>
  </Rule>
</LifecycleConfiguration>

and has a Content-Length of 397 and a MD5 of Or7bcOqR6tcsifiqQpq1tw==

I get this error:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>MalformedXML</Code>
  <Message>The XML you provided was not well-formed or did not validate against our published schema</Message>    
  <RequestId>FC82F477B48DF40D</RequestId>    
   <HostId>5nJaHpypZQ/boh5fmtYWcvozeRO/OYIfuvYRXj2Un56tWPP2sj2jpazl0Xyl09Ic4s2lxh0l+C8=</HostId>
</Error>

Any help on this is appreciated!

Thanks!




Aucun commentaire:

Enregistrer un commentaire