Creates tags and adds them to a resource.
Description
- Each tag consists of a tag key and a tag value. When you add a tag, you must specify the tag key and tag value.
- If you want to add multiple tags to a Cloud Enterprise Network (CEN) instance, each tag key must be unique.
- You can add at most 20 tags to a CEN instance.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | No | TagResources |
The operation that you want to perform. Set the value to TagResources. |
ResourceType | String | Yes | cen |
The type of the resource. Set the value to cen, which specifies a CEN instance. |
ResourceId.N | String | Yes | cen-pfa6ugf3xl0qsd**** |
The ID of the resource. You can enter multiple resource IDs. Valid values of N: 1 to 20. |
Tag.N.Key | String | Yes | TagKey |
The tag key. You can enter multiple tag keys. Valid values of N: 1 to 20. The key cannot exceed 64 characters in length, and cannot start with |
Tag.N.Value | String | Yes | TagValue |
The tag value. Each tag key corresponds to a tag value. Valid values of N: 1 to 20. The value cannot exceed 128 characters in length, and cannot start with |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | C46FF5A8-C5F0-4024-8262-B16B639225A0 |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=TagResources
&ResourceType=cen
&ResourceId=["cen-pfa6ugf3xl0qsd****"]
&Tag=[{"Key":"TagKey","Value":"TagValue"}]
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<TagResourcesResponse>
<RequestId>C46FF5A8-C5F0-4024-8262-B16B639225A0</RequestId>
</TagResourcesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "C46FF5A8-C5F0-4024-8262-B16B639225A0"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | InvalidTagKey | The tag keys are not valid. | The error message returned because the tag key is invalid. |
400 | DuplicatedParam.TagKey | The parameter TagKey is duplicated. | The error message returned because the specified tag key already exists. |
400 | IllegalParamLength.Tag | The specified length of Tag is invalid. | The error message returned because the length of the specified tag key has exceeded the upper limit. Check the limits and change the value accordingly. |
For a list of error codes, visit the API Error Center.