Creating Snapshots

Last updated: 2019-11-29 18:47:14

1. API Description

This API (CreateSnapshot) is used to create snapshots for the specified cloud disk. This API will return the ID of the newly created snapshot.
Domain for API

Usage restrictions:

  1. Only a cloud disk with snapshot ability can create snapshots. Whether a cloud disk has snapshot ability can be queried through DescribeCbsStorages (Query Cloud Disk Information)API. See the snapshotAbility field in output parameters.
  2. For the number of snapshots that can be created, refer to Product Usage Restriction.

2. Input Parameters

The following request parameter list only provides API request parameters. For other parameters, refer to Common Request Parameters.

Parameter Name Required Type Description
storageId Yes String ID of the cloud disk that needs to create snapshots, which can be queried via DescribeCbsStorages (Query Cloud Disk Information) API
snapshotName No String Snapshot name. If not passed, the new snapshot name is "Unnamed"

3. Output Parameters

Parameter Name Type Description
code Int Error code. 0: Succeeded; other values: Failed.
message String Error message
snapshotId String ID of the newly created snapshot

4. Error Code List

The following list only provides the business logic error codes for this API.
| Error Code | English Description | Error Description |
| ------- | ------- | ------- |
| 9003 | InvalidParameter | The parameter is incorrect |
| 16007 | IncorrectInstanceStatus.DiskTypeInvalid | This operation is not supported by the current cloud disk |
| 16026 | IncorrectInstanceStatus.SnapshotNotSupported | Snapshot is not supported by the cloud disk |
| 16005 | IncorrectInstanceStatus.DiskBusy | The disk is busy |
| 16006 | SnapshotQuotaExceeded | Snapshot limit is exceeded |
| 16027 | IncorrectInstanceStatus.CbsCreatingSnapshot | The cloud disk is creating a snapshot. Please try again later |

5. Example

<Common request parameters>

The returned results are as below. As can be seen in the result, a snapshot has been created successfully, and the snapshot ID is snap-o7zxxxr3.