Create automatic snapshot policy
Updated at:2025-10-20
This API enables the creation of an automatic snapshot policy.
Request structure
Plain Text
1POST /v{version}/asp?clientToken={clientToken} HTTP/1.1
2 Host: bcc.bj.baidubce.com
3 Authorization: authorization string
4 {
5 "name":name,
6 "timePoints":[timePoints],
7 "repeatWeekdays":[repeatWeekdays],
8 "retentionDays":retentionDays
9 }
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number |
| clientToken | String | Yes | Query | Idempotence Token, which is an ASCII string with a length not exceeding 64 bits. For details, see the [Link](BCC/API Reference/General Description.md#Idempotence) |
| name | String | Yes | RequestBody | The name of an automatic snapshot policy can include uppercase and lowercase letters, numbers, Chinese characters, and -\_ /special characters. It must start with a letter and have a length between 1 and 65 characters. |
| timePoints | List |
Yes | RequestBody | Specify the time points for daily snapshots, with values ranging from 0 to 23. |
| repeatWeekdays | List |
Yes | RequestBody | Specify the days of the week for snapshots, with values ranging from 0 to 6. |
| retentionDays | String | Yes | RequestBody | Specify the number of days to retain automatic snapshots. A value of -1 means the snapshots will be retained permanently. |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| aspId | String | Automatic snapshot policy ID |
Error codes
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| BadRequest | Bad request parameters or illegal request. | 400 | Invalid request parameters |
| Asp.NameInvalid | asp name is invalid. | 400 | Invalid name |
| Asp.RetentionDaysInvalid | RetentionDays should in [1,10000] | 400 | Invalid retention days |
| Asp.TimePointsInvalid | TimePoints should in [0,23] | 400 | Exceptional execution timestamp parameter |
| Asp.RepeatWeekdaysInvalid | RepeatWeekdays should in [1,7] | 400 | Exceptional execution date parameter |
Request example
Plain Text
1POST /v2/asp?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2 Host: bcc.bj.baidubce.com
3 Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4
5 {
6 "name":"asp-num1",
7 "timePoints":["20"],
8 "repeatWeekdays":["1","5"],
9 "retentionDays":"7"
10 }
Response example
Plain Text
1HTTP/1.1 200 OK
2 x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3 Date: Wed, 03 Dec 2014 06:42:19 GMT
4 Content-Type: application/json;charset=UTF-8
5 Server: BWS
6
7 {
8 "aspId" : "asp-oG6prjrl"
9 }
