Attaches tags to one or more ApsaraDB MyBase hosts.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No TagResources

The operation that you want to perform. Set the value to TagResources.

RegionId String Yes ap-southeast-1

The region ID of the host.

ResourceType String Yes DEDICATEDHOST

The type of the resource. Set the value to DEDICATEDHOST.

ResourceId.N String Yes ch-bp1yp3mqggn8****

The ID of host N. You can specify multiple host IDs.

N specifies the sequence number of the host. The following examples are provided:

  • ResourceId.1 specifies the ID of the first host.
  • ResourceId.2 specifies the ID of the second host.
Tag.N.Key String Yes demokey

The key of tag N.

  • N specifies the sequence number of the tag. The following examples are provided:
    • Tag.1.Key specifies the key of the first tag.
    • Tag.2.Key specifies the key of the second tag.
  • If the specified key does not exist, a tag that contains the specified key is automatically created.
Tag.N.Value String Yes demovalue

The value of tag N.

  • N specifies the sequence number of the tag. The following examples are provided:
    • Tag.1.Value specifies the value of the first tag.
    • Tag.2.Value specifies the value of the second tag.
  • If the specified value does not exist, a tag that contains the specified value is automatically created.

Response parameters

Parameter Type Example Description
RequestId String 4B938011-874B-5F54-8B9E-7E2A08B3AA13

The ID of the request.

Examples

Sample requests

http(s)://cddc.aliyuncs.com/?Action=TagResources
&RegionId=ap-southeast-1
&ResourceId=["ch-bp1yp3mqggn8****"]
&Tag=[{"Key":"demokey","Value":"demovalue"}]
&ResourceType=DEDICATEDHOST
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<TagResourcesResponse>
    <RequestId>4B938011-874B-5F54-8B9E-7E2A08B3AA13</RequestId>
</TagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "4B938011-874B-5F54-8B9E-7E2A08B3AA13"
}

Error codes

HttpCode Error code Error message Description
400 OperationDenied.QuotaExceed The Tags parameter number is exceed. Valid is 20. The error message returned because the number of tags that you want to attach to a single host exceeds the maximum number of 20.
400 NoPermission.SystemTag The operator is not permission for the system tag The error message returned because you cannot perform operations on system tags.
400 InvalidParameter.TagValue The Tag.%s.Value parameter - %s is invalid The error message returned because the specified tag value is a null value or exceeds 128 characters in length.
400 InvalidParameter.TagKey The Tag.%s.Key parameter - %s is invalid The error message returned because the specified tag key is a null value or exceeds 128 characters in length.
400 InvalidDedicatedHostId.NotFound The parameter - ResourceIds.N is not found. The error message returned because the resource that corresponds to the specified resource ID cannot be found.
400 MissingParameter.ResourceIds The parameter - ResourceIds.N should not be null. The error message returned because the resource IDs cannot be null values.

For a list of error codes, visit the API Error Center.