Creates a relationship between tag resources.

Notice You can only operate user tags.

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 header

Request syntax

POST|PATCH /openapi/tags HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
Resource_Ids String Yes ["es-cn-aaa","es-cn-bbb"]

The list of IDs of the ECS instances that you want to delete.

ResourceType String Yes INSTANCE

The resource type. Static field: INSTANCE.

Tags String Yes [{"key":"env","value":"IT"}]

The list of tags to be added. A maximum of 20 sub-items are allowed.

  • In addition to the required parameters, if the Key-Value pair of Tags contains a Key, the Key-Value pair must contain a Value. The Value can be an empty string. Otherwise, an error is returned InvalidParameter.TagKey.
  • If you pass a Duplicate Key-value pair, Duplicate Key does not match Duplicate Key. TagKey.
  • If the specified resource and Tag Key are existing before the custom Tag, the existing Tag Value is overwritten.

Response parameters

Parameter Type Example Description
RequestId String 3D8795D9-8FF5-46B2-86E6-E3B407*****

The ID of the request.

Examples

Sample requests

{
  "ResourceType":"INSTANCE",
  "ResourceIds":["es-cn-78v1g8t6t00****"],
  "Tags":[{"key":"env","value":"IT"}]
}

Sample success responses

XML format

<RequestId>B576F68B-F2B9-4111-941C-4156A****</RequestId>
<TagResources>
    <TagResource>
        <ResourceType>ALIYUN::ELASTICSEARCH::INSTANCE</ResourceType>
        <ResourceId>es-cn-78v1g8t6t00****</ResourceId>
        <TagKey>dep</TagKey>
        <TagValue>IT</TagValue>
    </TagResource>
    <TagResource>
        <ResourceType>ALIYUN::ELASTICSEARCH::INSTANCE</ResourceType>
        <ResourceId>es-cn-78v1g8t6t00****</ResourceId>
        <TagKey>env</TagKey>
        <TagValue>IT</TagValue>
    </TagResource>
</TagResources>

JSON format

{
    "RequestId": "B576F68B-F2B9-4111-941C-4156A****",
    "TagResources": {
        "TagResource": [
            {
                "ResourceType": "ALIYUN::ELASTICSEARCH::INSTANCE",
                "ResourceId": "es-cn-78v1g8t6t00****",
                "TagKey": "dep",
                "TagValue": "IT"
            },
            {
                "ResourceType": "ALIYUN::ELASTICSEARCH::INSTANCE",
                "ResourceId": "es-cn-78v1g8t6t00****",
                "TagKey": "env",
                "TagValue": "IT"
            }
        ]
    }
}

Error code

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