You can call this operation to create one or more tags for the specified resources.

Note Only resource groups support tags.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for API operations, call API operations, and dynamically generate SDK sample code.

Request parameters

Parameter Type Required Example Description
Action String Yes AddTags

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

GroupIds.N RepeatList Yes 12345

The ID of the resource group that you want to add tags to.

Tag.N.Key String Yes tagKey1

The key of the tag that you want to create.

N must be set to 1, 2, 3, 4, or 5. Key must be 1 to 64 characters in length.

Note N can not be an empty string, or start with aliyun or acs:. The Tag.N.Key and Tag.N.Value parameters must be set at the same time.
Tag.N.Value String Yes tagValue1

The value of the tag that you want to create.

N must be set to 1, 2, 3, 4, or 5. Value must be 1 to 64 characters in length.

Note N can not be an empty string, or start with aliyun or acs:. The Tag.N.Key and Tag.N.Value parameters must be set at the same time.

Response parameters

Parameter Type Example Description
RequestId String B04B8CF3-4489-432D-83BA-6F128E4F2295

The ID of the request.

Code String 200

The HTTP status code.

Note A value of 200 indicates that the call is successful.
Success Boolean true

Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.

Message String success

The error message.

Note If the status code 200 is returned, no error occurs.

Examples

Sample requests


http(s)://[Endpoint]/? Action=AddTags
&GroupIds.1=12345
&Tag.1.Key=tagKey1
&Tag.1.Value=tagValue1
&<Common request parameters>

Sample success responses

XML format

<Code>200</Code>
<RequestId>B04B8CF3-4489-432D-83BA-6F128E4F2295</RequestId>
<Success>true</Success>

JSON format

{
	"RequestId":"B04B8CF3-4489-432D-83BA-6F128E4F2295",
	"Success":true,
	"Code":"200"
}

Error codes

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