Updated on 2024-02-27 GMT+08:00

Creating an EVS Snapshot

Function

This API is used to create an EVS snapshot.

Calling Method

For details, see Calling APIs.

URI

POST /v3/{project_id}/snapshots

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The user token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

snapshot

Yes

CinderCreateSnapshotOption object

The information of the snapshot to be created.

Table 4 CinderCreateSnapshotOption

Parameter

Mandatory

Type

Description

volume_id

Yes

String

The ID of the snapshot's source disk.

To obtain the disk ID, see Querying Details About All Disks.

description

No

String

The snapshot description. The value can be null. You can enter up to 85 characters.

force

No

Boolean

The flag for forcibly creating the snapshot. The default value is false.

If this parameter value is false, snapshots cannot be forcibly created when the disk status is attaching. If this parameter value is true, snapshots can be forcibly created even when the disk status is attaching.

metadata

No

Map<String,String>

The snapshot metadata.

name

No

String

The snapshot name. You can enter up to 64 characters.

NOTE:

When a backup is created for a disk, a snapshot will also be created and named with the autobk_snapshot_ prefix. Operations cannot be performed on such snapshots. Therefore, you are advised not to use autobk_snapshot_ as the prefix of snapshot names to avoid any inconvenience.

Response Parameters

Status code: 202

Table 5 Response body parameters

Parameter

Type

Description

snapshot

SnapshotSummary object

The snapshot information.

Table 6 SnapshotSummary

Parameter

Type

Description

created_at

String

The time when the snapshot was created.

Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX

description

String

The snapshot description.

id

String

The snapshot ID.

metadata

Map<String,String>

The snapshot metadata.

If metadata contains the __system__enableActive field, the snapshot is auto-generated snapshot created during a server backup.

name

String

The snapshot name.

size

Integer

The snapshot size, in GiB.

status

String

The snapshot status. For details, see EVS Snapshot Status.

updated_at

String

The time when the snapshot was updated.

Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX

volume_id

String

The ID of the snapshot's source disk.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error

Error object

The error message returned if an error occurs.

Table 8 Error

Parameter

Type

Description

code

String

The error code returned if an error occurs.

For details about error codes and their meanings, see Error Codes.

message

String

The error message returned if an error occurs.

Example Requests

POST https://{endpoint}/v3/{project_id}/snapshots

{
  "snapshot" : {
    "name" : "snap-001",
    "description" : "Daily backup",
    "volume_id" : "5aa119a8-d25b-45a7-8d1b-88e127885635",
    "force" : false,
    "metadata" : { }
  }
}

Example Responses

Status code: 202

Accepted

{
  "snapshot" : {
    "status" : "creating",
    "description" : "Daily backup",
    "created_at" : "2013-02-25T03:56:53.081642",
    "metadata" : { },
    "volume_id" : "5aa119a8-d25b-45a7-8d1b-88e127885635",
    "size" : 1,
    "id" : "ffa9bc5e-1172-4021-acaf-cdcd78a9584d",
    "name" : "snap-001",
    "updated_at" : "2013-02-25T03:56:53.081642"
  }
}

Status code: 400

Bad Request

{
  "error" : {
    "message" : "XXXX",
    "code" : "XXX"
  }
}

Status Codes

Status Code

Description

202

Accepted

400

Bad Request

Error Codes

See Error Codes.