Problem description
In the request body XML of the PutBucketLifecycle request, the Days, CreatedBeforeDate, or ExpiredObjectDeleteMarker child node is missing in the Expiration node.
Causes
If the ExpiredObjectDeleteMarker child node is missing in the Expiration node in the request body XML, or the value of the ExpiredObjectDeleteMarker child node is false, you must specify the Days or CreatedBeforeDate child node. Otherwise, a request error occurs.
Examples
In the following request body XML, the Days or CreatedBeforeDate child node is missing in the Expiration node.
PUT /?lifecycle HTTP/1.1
Host: oss-example.oss.aliyuncs.com
Content-Length: 336
Date: Mon , 6 May 2019 15:23:20 GMT
Authorization: OSS LTAI**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>rule1</ID>
<Prefix>zzz</Prefix>
<Status>Enabled</Status>
<Expiration>
</Expiration>
</Rule>
</LifecycleConfiguration>Solutions
In the request body XML, add the
DaysorCreatedBeforeDatechild node to theExpirationnode.Days: specifies the number of days for the lifecycle rule to take effect after objects are last updated.
CreatedBeforeDate: specifies a date. OSS performs the specified operation on data whose last modification date is earlier than this date. The value of this parameter is in the yyyy-MM-ddT00:00:00.000Z format. Specify the time in the ISO 8601 standard. The time must be at 00:00:00 in UTC.
The following example shows how to add the
Dayschild node to theExpirationnode in the request body XML.PUT /?lifecycle HTTP/1.1 Host: oss-example.oss-cn-hangzhou.aliyuncs.com Content-Length: 336 Date: Mon , 6 May 2019 15:23:20 GMT Authorization: OSS LTAI**************:77Dv**************** <?xml version="1.0" encoding="UTF-8"?> <LifecycleConfiguration> <Rule> <ID>rule1</ID> <Prefix>zzz</Prefix> <Status>Enabled</Status> <Expiration> <Days>200</Days> </Expiration> </Rule> </LifecycleConfiguration>Configure lifecycle rules in the OSS console to avoid manually constructing request bodies.