路由

路由

GET /api/v4/routes

返回集群下的所有路由信息,支持分页机制。

Query String Parameters:

Name Type Required Default Description
_page Integer False 1 页码
_limit Integer False 10000 每页显示的数据条数,未指定时由 emqx-management 插件的配置项 max_row_limit 决定

Success Response Body (JSON):

Name Type Description
code Integer 0
data Array of Objects 所有路由信息
data[0].topic String MQTT 主题
data[0].node String 节点名称
meta Object 同 /api/v4/clients

Examples:

$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/routes"

{"meta":{"page":1,"limit":10000,"count":2},"data":[{"topic":"a/+/c","node":"emqx@127.0.0.1"},{"topic":"a/b/c","node":"emqx@127.0.0.1"}],"code":0}

GET /api/v4/routes/{topic}

返回集群下指定主题的路由信息。

Path Parameters:

Name Type Required Description
topic Integer True 主题

Success Response Body (JSON):

Name Type Description
code Integer 0
data Object 所有路由信息
data.topic String MQTT 主题
data.node String 节点名称

Examples:

$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/routes/a%2fb%2fc"

{"data":[{"topic":"a/b/c","node":"emqx@127.0.0.1"}],"code":0}