Adds tags to keys or secrets.
You can add multiple tags to multiple keys or multiple secrets at a time.
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 ID of the region to which the resource belongs. Note You can call the DescribeRegions operation to query a list of available regions of the current Alibaba Cloud account. |
ResourceType | String | Yes | key | The type of the resource to which you want to add tags. Valid values:
|
ResourceId.N | String | No | key-hzz62f1cb66fa42qo**** | The IDs of the resources to which you want to add tags. You can enter up to 50 resource IDs. Enter multiple resource IDs in the |
Tag.N.Key | String | No | disk-encryption | The tag key. A tag consists of a key-value pair. You can enter up to 20 tags. Enter multiple tags in the Each tag key can be up to 128 characters in length and can contain letters, digits, forward slashes (/), backslashes (\), underscores (_), hyphens (-), periods (.), plus signs (+), equal signs (=), colons (:), and at signs (@). Note The tag key cannot start with aliyun or acs:. |
Tag.N.Value | String | No | true | The tag value. A tag consists of a key-value pair. You can enter up to 20 tags. Enter multiple tags in the Each tag value can be up to 128 characters in length and can contain letters, digits, forward slashes (/), backslashes (\), underscores (_), hyphens (-), periods (.), plus signs (+), equal signs (=), colons (:), and at signs (@). |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 598d0219-45cd-4477-84ad-85a52d9debcf | The request ID. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=TagResources
&RegionId=cn-hangzhou
&ResourceType=key
&ResourceId=["key-hzz62f1cb66fa42qo****"]
&Tag=[{"Key":"disk-encryption","Value":"true"}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<TagResourcesResponse>
<RequestId>598d0219-45cd-4477-84ad-85a52d9debcf</RequestId>
</TagResourcesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "598d0219-45cd-4477-84ad-85a52d9debcf"
}
Error codes
Http status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.TagValue | The specified parameter is not valid. | The specified tag value is invalid. |
400 | InvalidParameter.TagKey | The specified parameter is not valid. | The specified tag key is invalid. |
400 | Duplicate.TagKey | The specified tagKey is duplicate. | The specified tag value is a duplicate. |
404 | InvalidAccessKeyId.NotFound | The Access Key ID provided does not exist in our records. | The specified AccessKey ID does not exist. |
404 | InvalidResourceId.NotFound | The specified ResourceId is not found. | The specified resource ID is not found. |
For a list of error codes, see Service error codes.