Updating ECS Metadata
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 /v2.1/{project_id}/servers/{server_id}/metadata
| 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
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| metadata | Yes | Object | Specifies the user-defined metadata key-value pair. For a metadata key: It cannot be left blank. Only uppercase letters, lowercase letters, digits, hyphens (-), underscores (_), colons (:), and periods (.) are supported. For a metadata value: A maximum of 255 characters are supported. |
Response
Example Request
Update the metadata of a specified ECS to the user-defined metadata key-value pair.
POST https://{endpoint}/v2.1/{project_id}/servers/{server_id}/metadata
{
"metadata": {
"key": "value"
}
} Example Response
{
"metadata":{
"key":"value"
}
} Returned Values
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.