You can call the TagResources operation to bind tags to resources.

  • All tags (key-value pairs) are applied to all resources of a specified ResourceId, with each resource specified as ResourceId.N.
  • Tag.N is a resource tag consisting of a key-value pair: Tag.N.Key and Tag.N.Value.
  • If you call this operation to tag multiple resources simultaneously, either all or none of the resources will be tagged.
  • If you specify Tag.1.Value in addition to required parameters, you must also specify Tag.1.Key. Otherwise, an InvalidParameter.TagKey error is reported. A tag that has a value must have the corresponding key, but the key can be an empty string.
  • If a tag with the same key has been bound to a resource, the new tag will overwrite the existing one.

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
ResourceId.N RepeatList Yes 285bb759342649a1b70c2093a772e087

The ID of the resource.

Valid values of N: 1 to 50.

ResourceType String Yes apiGroup

The type of the resource. Tags are bound to API groups, plug-ins, and applications. You can use tags to manage cloud resources by group. Valid values:

  • apiGroup
  • plugin
  • app
Tag.N.Key String Yes env

The key of tag N.

Valid values of N: 1 to 20.

Tag.N.Value String Yes ‘ ‘

The value of tag N.

Valid values of N: 1 to 20.

Action String No TagResources

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

Response parameters

Parameter Type Example Description
RequestId String EF924FE4-2EDD-4CD3-89EC-34E4708574E7

The ID of the request.

Examples

Sample requests

  1. http(s)://apigateway.cn-qingdao.aliyuncs.com/? Action=TagResources&ResourceId.1=285bb759342649a1b70c2093a772e087&ResourceType=apiGroup&Tag.1.Key=env&Tag.1.Value=’ ‘&<Common request parameters>

Sample success responses

XML format

  1. <TagResourcesResponse> <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId></TagResourcesResponse>

JSON format

  1. {“RequestId”:”EF924FE4-2EDD-4CD3-89EC-34E4708574E7”}

Error codes

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

  1. </article>
  2. </main>