Creating an EVS Snapshot

Function

This API is used to create an EVS snapshot.

URI

  • URI format

    POST /v3/{project_id}/snapshots

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

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

Request

  • Parameter description

    Parameter

    Type

    Mandatory

    Description

    snapshot

    Object

    Yes

    Specifies the information of the snapshot to be created. For details, see Parameters in the snapshot field.

  • Parameters in the snapshot field

    Parameter

    Type

    Mandatory

    Description

    volume_id

    String

    Yes

    Specifies the ID of the snapshot's source disk.

    force

    Boolean

    No

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

    • If this parameter is set to false and the disk is in the attaching state, the snapshot cannot be forcibly created.

    • If this parameter is set to true and the disk is in the attaching state, the snapshot can be forcibly created.

    metadata

    Object

    No

    Specifies the snapshot metadata.

    description

    String

    No

    Specifies the snapshot description. The value can be null. The value can contain a maximum of 255 bytes.

    name

    String

    No

    Specifies the snapshot name. The value can contain a maximum of 255 bytes.

    Note

    When creating a backup for a disk, a snapshot will be created and named with prefix autobk_snapshot_. The EVS console has imposed operation restrictions on snapshots with prefix autobk_snapshot_. Therefore, you are advised not to use autobk_snapshot_ as the name prefix for the snapshots you created. Otherwise, the snapshots cannot be used normally.

  • Example request

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

Response

  • Parameter description

    Parameter

    Type

    Description

    snapshot

    Object

    Specifies the snapshot information. For details, see Parameters in the snapshot field.

    error

    Object

    Specifies the error message returned when an error occurs. For details, see Parameters in the error field.

  • Parameters in the snapshot field

    Parameter

    Type

    Description

    id

    String

    Specifies the snapshot ID.

    status

    String

    Specifies the snapshot status. For details, see EVS Snapshot Status.

    name

    String

    Specifies the snapshot name.

    description

    String

    Specifies the snapshot description.

    created_at

    String

    Specifies the time when the snapshot was created.

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

    metadata

    Object

    Specifies the snapshot metadata.

    volume_id

    String

    Specifies the ID of the snapshot's source disk.

    size

    Integer

    Specifies the snapshot size, in GB.

    updated_at

    String

    Specifies the time when the snapshot was updated.

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

  • Parameters in the error field

    Parameter

    Type

    Description

    message

    String

    The error message returned if an error occurs.

    code

    String

    The error code returned if an error occurs.

    For details about the error code, see Error Codes.

  • Example response

    {
        "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"
        }
    }
    

    or

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

    In the preceding example, error indicates a general error, for example, badRequest or itemNotFound. An example is provided as follows:

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

Status Codes

  • Normal

    202

Error Codes

For details, see Error Codes.