Updated on 2022-11-02 GMT+08:00

Adding the Metadata for an EVS Disk

Function

This API is used to add or update the metadata of an EVS disk.

URI

  • URI format

    POST /v2/{project_id}/volumes/{volume_id}/metadata

  • Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    The project ID.

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

    volume_id

    Yes

    The disk ID.

Request

  • Request parameters

    Parameter

    Type

    Mandatory

    Description

    metadata

    Map<String,String>

    Yes

    The metadata to be updated. For details, see Parameter in the metadata field.

    The length of key and value under metadata can contain no more than 255 bytes.

  • Parameter in the metadata field

    Parameter

    Type

    Mandatory

    Description

    key_val

    String

    No

    The metadata information, which is made up of one or multiple key-value pairs.

  • Example request
    {
        "metadata": {
            "key1": "value1", 
            "key2": "value2"
        }
    }

Response

  • Response parameters

    Parameter

    Type

    Description

    metadata

    Object

    The disk metadata, which is made up of key-value pairs.

    error

    Object

    The error message returned if an error occurs. For details, see Parameters in the error field.

  • 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
    {
        "metadata": {
            "key1": "value1", 
            "key2": "value2"
        }
    }

    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:

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

Status Codes

  • Normal

    200

Error Codes

For details, see Error Codes.