All Products
Search
Document Center

Microservices Engine:ApplyTagPolicies

Last Updated:Jan 04, 2026

This operation modifies tag 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 of the application.

default

AppName

string

No

The application name.

example-app

AppId deprecated

string

Yes

The application ID.

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

Status

integer

No

The status.

Valid values:

  • 0 :

    Inactive

  • 1 :

    Active

  • 2 :

    Failed

0

Rate

integer

No

The percentage.

10

Enable

boolean

No

Specifies whether to enable the rule.

true

Tag

string

No

The environment for the routing rule.

gray

Name

string

No

The name of the routing rule.

gray

Id

integer

No

The rule ID.

1

InstanceNum

integer

No

The number of instances.

10

Rules

object

No

The rule details.

springcloud

array<object>

No

The Spring Cloud rules.

array<object>

No

condition

string

No

The logical operator for the items. Valid values: AND or OR.

AND

restItems

array<object>

No

object

No

datum

string

No

The value to compare for operators such as `rawvalue`.

10

operator

string

No

The operator. `rawvalue` indicates a direct comparison. `mode` indicates a modulo operation. `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 for the modulo operation. This parameter is required if `operator` is `mod`.

30

remainder

integer

No

The percentage value for the operation.

30

rate

integer

No

The percentage of traffic to route to the tagged nodes. For example, 20 means 20% of the traffic.

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 :

    a percentage-based rule

  • CONTENT :

    a content-based rule

CONTENT

enable

boolean

No

Specifies whether the rule is enabled.

true

appId

string

No

The application ID.

***@***

priority

integer

No

The priority.

1

tags

array

No

The list of tags.

string

No

A tag.

gray

paths

array

No

The list of paths.

string

No

A 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 application ID.

***@***

tags

array

No

The list of tags.

string

No

A tag.

gray

triggerPolicy

string

No

The policy type.

CONTENT

serviceName

string

No

The service name (interface).

HelloService

group

string

No

The group of the Dubbo service.

default

version

string

No

The version of the Dubbo service.

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 for the items. Valid values: AND or OR.

AND

argumentItems

array<object>

No

The list of arguments.

object

No

The argument details.

operator

string

No

The operator. `rawvalue` indicates a direct comparison. `mode` indicates a modulo operation. `list` indicates a whitelist.

rawvalue

nameList

array

No

The list of names.

string

No

A name.

demo

datum

string

No

The value to compare for operators such as `rawvalue`.

30

cond

string

No

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

==

divisor

integer

No

The divisor for the modulo operation. This parameter is required if `operator` is `mod`.

30

remainder

integer

No

The required percentage value for the percentage operation.

30

rate

integer

No

The percentage of traffic to route to the tagged nodes. For example, 20 means 20% of the traffic.

10

index

integer

No

The position of the parameter, starting from 0.

0

expr

string

No

The expression.

value

any

No

The value to compare. The result of the expression is compared with this value. If `operator` is `list`, use a comma (,) to separate multiple values. Example: 1,2,3.

1,2,3

NamespaceId

string

No

The ID of the namespace. This parameter is optional.

12233****

Enable

boolean

No

Specifies whether to enable the rule.

true

AcceptLanguage

string

No

The language of the response message:

  • 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 returned data.

object

The returned data.

Status

integer

The status.

1

InstanceNum

integer

The number of instances.

1

Remove

boolean

Indicates whether the rule was deleted.

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 rule.

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

Id

integer

The primary key ID.

12

Rate

integer

The percentage.

10

Enable

boolean

Indicates whether the rule is enabled.

  • true: enabled.

  • false: disabled.

true

Success

boolean

Indicates whether the request was successful.

true

Examples

Success response

JSON format

{
  "Message": "success",
  "RequestId": "316F5F64-F73D-42DC-8632-01E308B6****",
  "Data": [
    {
      "Status": 1,
      "InstanceNum": 1,
      "Remove": true,
      "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.