Creates tags and adds the tags to resources.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | TagResources | The operation that you want to perform. Set the value to TagResources. |
RegionId | String | Yes | cn-hangzhou | The region ID of the Classic Load Balancer (CLB) instance. You can call the DescribeRegions operation to query the most recent region list. |
ResourceType | String | Yes | instance | The type of the resource. Valid values:
|
ResourceId.N | String | No | lb-bp16qjewdsunr41m1**** | The resource ID. You can specify up to 20 IDs. Note If you want to specify the ID of a listener, set ResourceId to a value in the LoadBalancerId_Listener protocol_Port format, where LoadBalancerId specifies the ID of the CLB instance, and Port specifies the listener port. Example: lb-bp1snb10sbml4_http_80. |
Tag.N.Key | String | No | FinanceDept | The key of tag N to add to the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. The tag key can be up to 64 characters in length, and cannot contain |
Tag.N.Value | String | No | FinanceJoshua | The value of tag N to add to the resource. You can specify up to 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length, and cannot contain |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | C46FF5A8-C5F0-4024-8262-B16B639225A0 | The request ID. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=TagResources
&RegionId=cn-hangzhou
&ResourceType=instance
&ResourceId=["lb-bp16qjewdsunr41m1****"]
&Tag=[{"Key":"FinanceDept","Value":"FinanceJoshua"}]
&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 | TagTypeNotSame | The category of tags in the same request must be the same. | The specified tags in the request are of different types. |
400 | ResourceNotExist | %s. | The specified resource is not found. |
400 | DeniedForNoneTagCreator | %s. | The system tag is not created by the current account. |
400 | DeniedForScopeNotEqual | %s. | The key of a system tag cannot have different Scope values. |
400 | InvalidParam.Scope | The specified Scope is invalid. | Scope is set to an invalid value. Specify a valid value and try again. |
400 | InvalidParam.ResourceType | The specified ResourceType is invalid. | The specified resource type is invalid. Specify a valid resource type and try again. |
400 | InvalidParam.TagKey | The specified TagKey is invalid. | The specified tag key is invalid. Specify a valid tag key and try again. |
400 | InvalidParam.TagValue | The specified TagValue is invalid. | The specified tag value is invalid. Specify a valid tag value and try again. |
400 | InvalidParam.TagKeyOrValue | The specified TagKey or TagValue is invalid. | The specified tag key or tag value is invalid. Specify a valid key-value pair and try again. |
400 | InvalidParam.TagOwnerUid | The specified TagOwnerUid is invalid. | TagOwnerUid is set to an invalid value. Specify a valid value and try again. |
400 | InvalidParam.TagOwnerBid | The specified TagOwnerBid is invalid. | TagOwnerBid is set to an invalid value. Specify a valid value and try again. |
400 | MissingParam.TagKey | The parameter TagKey is required. | TagKey is not specified. |
400 | MissingParam.Scope | The parameter Scope is required. | Scope is not specified. |
400 | MissingParam.TagOwnerUid | The parameter TagOwnerUid is required. | TagOwnerUid is not specified. |
400 | MissingParam.TagOwnerBid | The parameter TagOwnerBid is required. | TagOwnerBid is not specified. |
400 | InvalidParameter.RegionId | The specified RegionId does not exist. | The specified region ID is not found. |
400 | DeniedForOperateCustomTag | %s. | You cannot modify or delete the tag with the current account. |
400 | MissingParam.ResourceId | The parameter ResourceId is required. | ResourceId is not specified. |
400 | Duplicate.TagKey | The param TagKey has duplicate value. | The specified tag key already exists. |
400 | SizeLimitExceeded.ResourceId | The maximum size of ResourceId is exceeded. | The length of the specified resource ID exceeds the limit. Specify a valid resource ID and try again. |
400 | SizeLimitExceeded.Tag | The maximum size of Tag is exceeded. | The length of the specified tag exceeds the limit. Specify a valid tag and try again. |
For a list of error codes, see Service error codes.