Updated on 2024-04-23 GMT+08:00

Querying a List of Rules

Function

This API is used to query all rules.

URI

GET /v2/{project_id}/routemgr/rules?{name=xxx,limit=xxx,offset=xxx}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

name

No

String

Rule name.

limit

No

Integer

Maximum number of records that can be returned.

offset

No

Integer

Offset. The records after this offset will be queried.

Request

Table 3 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response

When the status code is 200, the response parameters are as follows:

Table 4 Parameters in the response body

Parameter

Type

Description

count

Long

Number of rules that meet the conditions.

rules

Array of RuleResponse objects

Rule list.

Table 5 RuleResponse

Parameter

Type

Description

created_at

String

Creation time.

description

String

Rule description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

fail_messages

Integer

Number of messages that fail to be forwarded.

id

String

Rule ID.

ief_instance_id

String

Platinum edition instance ID. This parameter is left blank for a professional edition instance.

in_using

Boolean

Whether to enable the rule. The default value is true, indicating that the rule is enabled.

name

String

Rule name. The value contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

The rule name must be unique in the account.

project_id

String

Project ID.

source

EndpointResponse object

Source endpoint information.

source_resource

Map<String,Object>

Source endpoint resource. Example:

  • rest:
    {"path":"<standard uri format>"}
  • eventbus:
    {"topic": "<project id>/nodes/<node id>/user/<Customized character string that meets the Eventbus topic requirements>","node_id":"<Node ID>"}

success_messages

Integer

Number of messages that are successfully forwarded.

target

EndpointResponse object

Destination endpoint information.

target_resource

Map<String,Object>

Destination endpoint resource. Example:

  • dis:
    {"channel": "dis channel name"}
  • servicebus:
    {"path": "/request path"}
  • apigw:
    {"resource": "http://ssss.com"}
  • eventbus:
    {"topic": "/xxxx"}

updated_at

String

Update time.

Table 6 EndpointResponse

Parameter

Type

Description

created_at

String

Creation time.

description

String

Endpoint description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

id

String

Endpoint ID.

ief_instance_id

String

Platinum edition instance ID. This parameter is left blank for a professional edition instance.

is_shared

Boolean

Whether the endpoint is shared.

name

String

Endpoint name. The value contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

The endpoint name must be unique in the account.

project_id

String

Project ID.

properties

Map<String,Object>

Endpoint properties to be displayed. Example:

  • dis:
    {"domain_id":"user's domain id"}
  • servicebus:
    {"service_port":8080}
  • apigw:
    {"domain_id":"user's domain id"}

type

String

Endpoint type.

The options are as follows:

  • dis
  • servicebus
  • apigw

updated_at

String

Update time.

When the status code is 401, the response parameters are as follows.

Table 7 Parameters in the response body

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error message.

When the status code is 500, the response parameters are as follows:

Table 8 Parameters in the response body

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error message.

Example Request

None

Example Response

None

Status Codes

Status Code

Description

200

Query succeeded.

401

Error response.

500

Error response.

Error Codes

For details, see Error Codes.