Adds tags to resource groups or the members in a resource directory.

Usage notes

This topic provides an example on how to call the API operation to add the tag k1:v1 to the resource group with an ID of rg-aekz6bre2uq****.

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 Yes TagResources

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

ResourceId.N String Yes rg-aekz6bre2uq****

The ID of a resource group or member.

You can specify a maximum of 50 IDs.

Tag.N.Key String No k1

A tag key.

A tag key can be a maximum of 128 characters in length. It cannot contain http:// or https:// and cannot start with acs: or aliyun.

Tag.N.Value String No v1

A tag value.

A tag value can be a maximum of 128 characters in length. It cannot contain http:// or https:// and cannot start with acs:.

ResourceType String No ResourceGroup

The type of the objects to which you want to add tags. Valid values:

  • ResourceGroup : resource group. This is the default value.
  • Account: member.
Note This parameter is required if you add tags to members in a resource directory.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String E7747EDF-EDDC-5B38-9B6A-6392B9C92B1C

The ID of the request.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=TagResources
&ResourceId.1=rg-aekz6bre2uq****
&Tag.1.Key=k1
&Tag.1.Value=v1
&<Common request parameters>

Sample success responses

XML format

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

<TagResourcesResponse>
    <RequestId>E7747EDF-EDDC-5B38-9B6A-6392B9C92B1C</RequestId>
</TagResourcesResponse>

JSON format

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

{
  "RequestId" : "E7747EDF-EDDC-5B38-9B6A-6392B9C92B1C"
}

Error codes

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