Adding a Resource Tag
Function
This API is used to add tags to a resource.
A resource can have a maximum of 20 tags.
This API is an idempotent API. If the tag to be created already exists (with the same key), the existing tag will be overwritten.
URI
POST /v2/{project_id}/{resource_type}/{resource_id}/tags
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
resource_type |
Yes |
String |
Resource type.
|
resource_id |
Yes |
String |
Resource ID. |
Request
Request parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Message body type (format). The default value application/json is recommended. |
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tag |
Yes |
tag object |
Whether tags are contained. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key, which can contain a maximum of 36 Unicode characters. This parameter cannot be left blank and can contain only letters, digits, hyphens (-), and underscores (_). |
value |
Yes |
String |
Tag value. Each value can contain a maximum of 43 Unicode characters. This parameter cannot be left blank and can contain only letters, digits, hyphens (-), and underscores (_). |
Example request
{ "tag": { "key": "key0", "value": "ief-tag-test" } }
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot