Updating ECS Metadata
Function
This API is used to update ECS metadata.
- If the metadata does not contain the field to be updated, the field is automatically added.
- If the metadata contains the field to be updated, the field value is automatically updated.
- If the field in the metadata is not requested, the field value remains unchanged.
If the metadata contains sensitive data, take appropriate measures to protect the sensitive data, for example, controlling access permissions and encrypting the data.
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
|
Parameter |
Mandatory |
Description |
|---|---|---|
|
project_id |
Yes |
Definition Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
|
server_id |
Yes |
Definition Specifies the ECS ID. Constraints N/A Range N/A Default Value N/A |
Request
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
metadata |
Yes |
Map<String,String> |
Definition This API is used to update ECS metadata. You can use metadata to customize key-value pairs. For details about reserved key-value pairs, see Table 11. Constraints If the metadata contains sensitive data, take appropriate measures to protect the sensitive data, for example, controlling access permissions and encrypting the data. Range
Default Value N/A |
Response
|
Parameter |
Type |
Description |
|---|---|---|
|
metadata |
Object |
Definition Specifies the user-defined metadata key-value pair. Range N/A |
Example Request
Updated the metadata of an ECS with the user-defined metadata key-value pair.
POST https://{endpoint}/v1/{project_id}/cloudservers/{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.