Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

Updating ECS Metadata

Updated on 2022-09-23 GMT+08:00

Function

This API is used to update ECS metadata.

  • 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.
  • If the field in the metadata is not requested, the field value remains unchanged.

Constraints

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

URI

POST /v1/{project_id}/cloudservers/{server_id}/metadata

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

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

server_id

Yes

Specifies the ECS ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

metadata

Yes

Object

Specifies the user-defined metadata key-value pair.

The data structure can be empty. If the value is empty, data is not updated.

For a metadata tag:

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

For a metadata value:

It contains a maximum of 255 Unicode characters.

Response

Table 3 Parameter description

Parameter

Type

Description

metadata

Object

Specifies the user-defined metadata key-value pair.

Example Request

POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/metadata
{
    "metadata": {
        "key": "value"
    }
}

Example Response

{
    "metadata":{
        "key":"value"
    }
} 
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback