GetBucketLifecycle
Updated at:2025-11-03
API description
This API retrieves detailed information about configured lifecycle management rules.
Request
-
Request syntax
Plain Text1GET /?lifecycle HTTP/1.1 2Host: <BucketName>.bj.bcebos.com 3Date: date 4Authorization: AuthorizationString -
Request headers
No special parameters
-
Request parameters
No special parameters
Response
| Rule item | Description | Required or not | Remarks |
|---|---|---|---|
| rule | Rule list | Required | List of all rules |
| +id | The identifier for the rule. | Required | Rule IDs must be unique within the same bucket and cannot be duplicated. If the user does not provide an ID, the system will generate one automatically. |
| +status | Status of the rule. | Required | The value is either enabled or disabled; the rule will not take effect when it is set to disabled. |
Plain Text
1| +resource | Resources to which the rules apply. | Required | Example: To apply to objects in samplebucket with the prefix/: `samplebucket/prefix/*`; to apply to all objects in samplebucket: `samplebucket/*`. |
2 | +condition | The condition on which the rule depends. | Optional | Currently, only the time format is supported, and this field is required under basic lifecycle rules.
3 |+ExpiredObjectDeleteMarker | Delete marker of expired object. |Optional| Values can be `true` or `false`||
4. | +time | Time constraints. | Optional | It is implemented through the defined `dateGreaterThan`, with no fill parameters under intelligent tiering Configuration |
5 | ++dateGreaterThan | Describe temporal relationships. | Required | Support absolute time "date" and relative time "days". The format of absolute time (date) is yyyy-mm-ddThh:mm:ssZ, e.g., 2016-09-07T00:00:00Z. Absolute time must be in UTC and end with 00:00:00 (UTC 0:00). The description of relative time "days" follows ISO8601, with the minimum time granularity being a day. For example, $(lastModified)+P7D indicates the time 7 days after the last-modified time of the object. |
6 | action | Action executed on the resource. | Optional | This field is required under basic lifecycle rules. |
7 | +name | Name of the executed operation. | Required | Valid values are `Transition`, `DeleteObject` and `AbortMultipartUpload`. |
8 | +storageClass | Object storage class | Optional | When action is `Transition`, it can be set with values `STANDARD_IA` or `COLD` or `ARCHIVE`, indicating a transition from the original storage class to infrequent access storage, cold storage, or archive storage.
Notes
- If the source bucket specified in the request does not exist, a 404 error will be returned with the code "NoSuchBucket.\
- If the requested source bucket lacks a lifecycle configuration, a 404 error with the code NoLifecycleConfiguration will be returned.
Example of basic lifecycle request
-
Request example
Plain Text1 GET /?lifecycle HTTP/1.1 2 Host: <BucketName>.bj.bcebos.com 3 Date: Thu, 15 Sep 2016 00:16:26 GMT 4 Authorization: AuthorizationString -
Response example
Plain Text1 HTTP/1.1 200 OK 2 Date: Thu, 15 Sep 2016 00:17:23 GMT 3 Server: BceBos 4 x-bce-request-id: 1a5fd81e-626b-45b3-a885-15fff9cd106c 5 Connection: keep-alive 6 Content-Length: 358 7 { 8 "rule": [ 9 { 10 "id": "sample-rule-delete-prefix", 11 "status": "enabled", 12 "resource": [ 13 "bucket/prefix/*" 14 ], 15 "condition": { 16 "time": { 17 "dateGreaterThan": "2016-09-07T00:00:00Z" 18 } 19 }, 20 "action": { 21 "name": "DeleteObject" 22 } 23 }, 24 { 25 "id": "sample-rule-transition-prefix", 26 "status": "enabled", 27 "resource": [ 28 "bucket/prefix/*" 29 ], 30 "condition": { 31 "time": { 32 "dateGreaterThan": "$(lastModified)+P7D" 33 } 34 }, 35 "action": { 36 "name": "Transition", 37 "storageClass": "STANDARD_IA" 38 } 39 }, 40 { 41 "id": "sample-rule-abort-multiupload-prefix", 42 "status": "enabled", 43 "resource": [ 44 "bucket/prefix/*" 45 ], 46 "condition": { 47 "time": { 48 "dateGreaterThan": "$(lastModified)+P7D" 49 } 50 }, 51 "action": { 52 "name": "AbortMultipartUpload" 53 } 54 } 55 ] 56 }
Example of intelligent tiering request
-
Request syntax
Plain Text1 GET /?lifecycle HTTP/1.1 2 Host: <BucketName>.bj.bcebos.com 3 Date: Tue, 26 Jul 2022 05:01:28 GMT 4 Authorization: AuthorizationString -
Response example
Plain Text1HTTP/1.1 200 OK 2Date: Tue, 26 Jul 2022 09:41:29 GMT 3Server: BceBos 4x-bce-request-id: ac07037d-f40e-45e0-b126-e38adc238cad 5Connection: keep-alive 6Content-Length: 740 7{ 8 "rule": [ 9 { 10 "id": "sample-rule-intelligent-tiering-prefix", 11 "status": "enabled", 12 "resource": [ 13 "bucket/*" 14 ], 15 "action": { 16 "name": "IntelligentTiering" 17 } 18 }, 19 { 20 "id": "sample-rule-delete-prefix", 21 "status": "enabled", 22 "resource": [ 23 "bucket/*" 24 ], 25 "condition": { 26 "time": { 27 "dateGreaterThan": "$(lastModified)+P365D" 28 } 29 }, 30 "action": { 31 "name": "DeleteObject" 32 } 33 }, 34 { 35 "id": "sample-rule-abort-multiupload-prefix", 36 "status": "enabled", 37 "resource": [ 38 "bucket/*" 39 ], 40 "condition": { 41 "time": { 42 "dateGreaterThan": "$(lastModified)+P7D" 43 } 44 }, 45 "action": { 46 "name": "AbortMultipartUpload" 47 } 48 } 49 ] 50}
