All Products
Search
Document Center

API Gateway:TagResources

Last Updated:Mar 06, 2025

Adds user tags to resources.

Operation description

  • 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
apigateway:TagResourcescreate
*ApiGroup
acs:apigateway:{#regionId}:{#accountId}:apigroup/{#ResourceId}
*App
acs:apigateway:{#regionId}:{#accountId}:app/{#ResourceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceTypestringYes

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
apiGroup
Tagarray<object>Yes

The tag of objects that match the lifecycle rule. You can specify multiple tags.

2021022811
objectYes

The tag of objects that match the lifecycle rule. You can specify multiple tags.

KeystringYes

The key of tag N.

env
ValuestringYes

The value of tag N.

' '
ResourceIdarrayYes

The ID of the resource.

stringYes

The ID of the resource.

285bb759342649a1b70c2093a772e087

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

EF924FE4-2EDD-4CD3-89EC-34E4708574E7

Examples

Sample success responses

JSONformat

{
  "RequestId": "EF924FE4-2EDD-4CD3-89EC-34E4708574E7"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-11-14API Description UpdateView Change Details