• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. Metadata Management
  6. Modifying Metadata of an ECS Key

Modifying Metadata of an ECS Key

Function

This API is used to modify the metadata of an ECS key.

  • If the metadata does not contain the target field, the field is automatically added.
  • If the metadata contains the target field, the field value is automatically updated.

Constraints

An ECS must be in active, stopped, paused, or suspended state, which is specified by OS-EXT-STS:vm_state.

URI

PUT /v2.1/{project_id}/servers/{server_id}/metadata/{key}

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

key

Yes

Specifies the ECS metadata key to be modified.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

meta

Yes

Dict

Specifies the user-defined metadata key pair.

Table 3 meta field description

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key.

It contains a maximum of 255 Unicode characters and cannot be blank. The value can contain uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), hyphens (-), underscores (_), colons (:), and periods (.).

value

Yes

String

Specifies the tag value.

It contains a maximum of 255 Unicode characters.

Response

Response parameters

Table 4 describes the response parameters.
Table 4 Response parameters

Parameter

Type

Description

meta

Dict

Specifies the user-defined metadata key-value pair.

Examples

  • Example request
    {
        "meta":{
            "key":"value"
        }
    } 
  • Example response
    {
        "meta":{
            "key":"value"
        }
    } 

Returned Values

See General Request Returned Values.