Create an Automatic Snapshot Policy
Last Updated:2020-07-20
This API is used to create an automatic snapshot policy.
Request Structure
POST /v{version}/asp?clientToken={clientToken} HTTP/1.1
 Host: bcc.bj.baidubce.com
 Authorization: authorization string
 {
     "name":name,
     "timePoints":[timePoints],
     "repeatWeekdays":[repeatWeekdays],
     "retentionDays":retentionDays
 }Request Header Field
There are no other special header fields except the public header field.
Request Parameters
| Parameter Name | Type | Required | Parameter Position | Description | 
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number | 
| clientToken | String | Yes | Query Parameter | The idempotent Token is an ASCII string with a length not exceeding 64 bits. For more information, please see the Link | 
| name | String | Yes | RequestBody parameter | Name of automatic snapshot policy, which supports uppercase and lowercase letters, numbers, Chinese, -, ,_,/and.. Special characters with length 1-65, it must begin with the letter | 
| timePoints | List<String> | Yes | RequestBody parameter | Time points for snapshot in a day, the value is 0-23 | 
| repeatWeekdays | List<String> | Yes | RequestBody parameter | Time for snapshot in a week, the value is within 0-6 | 
| retentionDays | String | Yes | RequestBody parameter | Automatic snapshot retention days, permanent retention when the value is -1 | 
Return Header Field
There are no other special header fields except the common header field.
Return Parameter
| Parameter Name | Type | Description | 
|---|---|---|
| aspId | String | Automatic snapshot policy ID created | 
Error Code
| Error Code | Error Description | HTTP Status Code | Explanations | 
|---|---|---|---|
| BadRequest | Bad request parameters or illegal request. | 400 | Invalid request parameter | 
| Asp.NameInvalid | asp name is invalid. | 400 | The snapshot name is invalid. | 
| Asp.RetentionDaysInvalid | RetentionDays should in [1,10000] | 400 | The days format of retention is invalid. | 
| Asp.TimePointsInvalid | TimePoints should in [0,23] | 400 | The time point parameter is abnormal. | 
| Asp.RepeatWeekdaysInvalid | RepeatWeekdays should in [1,7] | 400 | The date parameter is abnormal. | 
Request Instance
POST /v2/asp?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
 Host: bcc.bj.baidubce.com
 Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
 
 {
     "name":"asp-num1",
     "timePoints":["20"],
     "repeatWeekdays":["1","5"],
     "retentionDays":"7"
 }Return Instance
HTTP/1.1 200 OK
 x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
 Date: Wed, 03 Dec 2014 06:42:19 GMT
 Content-Type: application/json;charset=UTF-8
 Server: BWS 
 
 {
     "aspId" : "asp-oG6prjrl"
 }