All Products
Search
Document Center

Microservices Engine:ApplyTagPolicies

Last Updated:Oct 21, 2026

Modifies tag-based routing rules.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

mse:ApplyTagPolicies

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Region

string

No

The region.

cn-hangzhou

Namespace

string

No

The MSE namespace to which the application belongs.

default

AppName

string

No

The name of the application.

example-app

AppId deprecated

string

Yes

The ID of the application.

h5pohqu3gd@xxx

Rules

object

No

The routing rules.

{ "blue": { # Tag key. "rate": 20, # Rate. A value of 20 indicates that 20% of the traffic is routed to the node identified by the tag. "name": "luoye-route-test", # Routing rule name. "carryData": false, # Specifies whether to enable pass-through. This parameter is applicable to end-to-end canary release. "rules": { # Rule information. "dubbo": \[{ # Dubbo rule. The system also supports Spring Cloud and Istio rule. "serviceName": "com.taobao.hsf.common.DemoService", # Service name (operation name). "group": "", # Group name. "version": "", # Service version. "methodName": "sayHello", # Method name. "condition": "AND", # Logical operator used by the following items. Valid values: AND and OR. "argumentItems": \[{ # Array of rule details. "index": 0, # Index field. "expr": "", # Expression. Its details is described below. "operator": "rawvalue", # The comparison mode. A value of rawvalue indicates direct comparison. A value of mode indicates the modulo operation. A value of list indicates using a whitelist. "value": "jim", # Base value. The value obtained by the expression will be compared with this value. If operator is set to list, separate the items specified for this parameter with commas (,). Example: 1,2,3. "cond": "==" # Comparison operator. Valid values: >=, <=, >, <, and ==. }] }] } }, "\_base": { # Another tag key. "rate": 80 # Rate. A value of 20 indicates that 20% of the traffic is routed to the node identified by the tag. } }

object

No

The configuration of a single tag-based routing rule.

Status

integer

No

The status.

Valid values:

  • 0 :

    inactive.

  • 1 :

    active.

  • 2 :

    invalid.

0

Rate

integer

No

The percentage.

10

Enable

boolean

No

Specifies whether the rule is enabled.

true

Tag

string

No

The environment of this routing rule.

gray

Name

string

No

The name of the routing rule.

gray

Id

integer

No

The ID of the rule.

1

InstanceNum

integer

No

The number of instances.

10

Rules

object

No

The rule information.

springcloud

array<object>

No

The Spring Cloud rules.

array<object>

No

condition

string

No

The logical operator used between the following items. Valid values: AND and OR.

AND

restItems

array<object>

No

The list of matching conditions for REST requests.

object

No

datum

string

No

The value to be compared for operators such as rawvalue.

10

operator

string

No

The operator. A value of rawvalue indicates direct comparison. A value of mode indicates a modulo operation. A value of list indicates a whitelist.

rawvalue

nameList

array

No

The field required for the list operator.

string

No

The name.

test1

cond

string

No

The comparison operator. Valid values: >=, <=, >, <, and ==.

==

divisor

integer

No

The divisor field required for the mod operator.

30

remainder

integer

No

The percentage value field required for the percentage operation.

30

rate

integer

No

The proportion rule. For example, 20% indicates that 20% of the traffic is routed to the node corresponding to the tag.

20

type

string

No

The type.

test

name

string

No

The name.

key

value

any

No

The value.

test

triggerPolicy

string

No

The policy type.

Valid values:

  • PERCENT :

    proportion rule.

  • CONTENT :

    content matching rule.

CONTENT

enable

boolean

No

Specifies whether the rule is enabled.

true

appId

string

No

The ID of the application.

***@***

priority

integer

No

The priority.

1

tags

array

No

The list of tags.

string

No

The tag.

gray

paths

array

No

The list of paths.

string

No

The path.

/hello

path

string

No

The path.

/hello

dubbo

array<object>

No

The Dubbo rules.

array<object>

No

The rule content.

appId

string

No

The ID of the application.

***@***

tags

array

No

The list of tags.

string

No

The tag.

gray

triggerPolicy

string

No

The policy type.

CONTENT

serviceName

string

No

The service name (interface).

HelloService

group

string

No

The Dubbo service group.

default

version

string

No

The Dubbo service version.

1.0.0

methodName

string

No

The method name of the Dubbo service.

hello

paramTypes

array

No

The list of parameter types.

string

No

The parameter type.

int

condition

string

No

The logical operator used between the following items. Valid values: AND and OR.

AND

argumentItems

array<object>

No

The list of parameter content.

object

No

The parameter content.

operator

string

No

The operator. A value of rawvalue indicates direct comparison. A value of mode indicates a modulo operation. A value of list indicates a whitelist.

rawvalue

nameList

array

No

The list of names.

string

No

The name.

demo

datum

string

No

The value to be compared for operators such as rawvalue.

30

cond

string

No

The comparison operator. Valid values: >=, <=, >, <, and ==.

==

divisor

integer

No

The divisor field required for the mod operator.

30

remainder

integer

No

The percentage value field required for the percentage operation.

30

rate

integer

No

The proportion rule. For example, 20% indicates that 20% of the traffic is routed to the node corresponding to the tag.

10

index

integer

No

The position of the parameter, starting from 0.

0

expr

string

No

The expression. See other field descriptions for details.

value

any

No

The value to compare. The value obtained from the expression is compared with this value. If the operator is a list whitelist, separate values with commas (,), such as 1,2,3.

1,2,3

NamespaceId

string

No

The namespace ID. This parameter is optional.

12233****

Enable

boolean

No

Specifies whether the rule is enabled.

true

AcceptLanguage

string

No

The language of the response. Valid values:

  • zh: Chinese.

  • en: English.

zh

Response elements

Element

Type

Description

Example

object

Message

string

The response message.

success

RequestId

string

The request ID.

316F5F64-F73D-42DC-8632-01E308B6****

Data

array<object>

The data overview.

object

The data overview.

Status

integer

The effective status.

1

InstanceNum

integer

The number of instances.

1

Remove

boolean

Indicates whether the deletion is successful.

CarryData

boolean

Indicates whether it is a primary key.

true

Tag

string

The tag.

gray

Name

string

The policy name.

test

Rules

string

The tag rules.

{\"_base\": {\"rate\": 100, \"remove\": true}, \"blue\": {\"rate\": 0}}

Id

integer

The primary key ID.

12

Rate

integer

The ratio.

10

Enable

boolean

Indicates whether the feature is enabled. Valid values:

  • true: Enabled.

  • false: Disabled.

true

Success

boolean

The request result.

true

Examples

Success response

JSON format

{
  "Message": "success",
  "RequestId": "316F5F64-F73D-42DC-8632-01E308B6****",
  "Data": [
    {
      "Status": 1,
      "InstanceNum": 1,
      "Remove": false,
      "CarryData": true,
      "Tag": "gray",
      "Name": "test",
      "Rules": "{\\\"_base\\\": {\\\"rate\\\": 100, \\\"remove\\\": true}, \\\"blue\\\": {\\\"rate\\\": 0}}",
      "Id": 12,
      "Rate": 10,
      "Enable": true
    }
  ],
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 IllegalRequest Invalid request:%s Invalid request: %s
400 InvalidParameter Parameter error:%s Request parameter error: %s
500 InternalError Console error. Try again later:%s Console error. Try again later: %s
403 NoPermission You are not authorized to perform this operation:%s You do not have the permission to use this interface:%s
404 NotFound Not found:%s The resource does not exist:%s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.