< EMQX Dedicated latest API Documentation 反馈文档问题

EMQX Dedicated REST API (v5)

Download OpenAPI specification:

EMQX Dedicated REST API

Actions

列出动作类型

列出所有可用的动作类型。

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
[
  • "rabbitmq",
  • "emqx_tables",
  • "alloydb",
  • "iotdb",
  • "mysql",
  • "doris",
  • "bigquery",
  • "tdengine",
  • "kinesis",
  • "elasticsearch",
  • "sqlserver",
  • "s3tables",
  • "oracle",
  • "timescale",
  • "azure_blob_storage",
  • "clickhouse",
  • "disk_log",
  • "tablestore",
  • "snowflake",
  • "syskeeper_forwarder",
  • "datalayers",
  • "pgsql",
  • "kafka_producer",
  • "influxdb",
  • "http",
  • "redis",
  • "opents",
  • "confluent_producer",
  • "rocketmq",
  • "snowflake_streaming",
  • "s3",
  • "dynamo",
  • "cassandra",
  • "greptimedb",
  • "pulsar",
  • "mqtt",
  • "couchbase",
  • "mongodb",
  • "cockroachdb",
  • "matrix",
  • "gcp_pubsub_producer",
  • "aws_timestream",
  • "redshift",
  • "azure_event_hub_producer"
]

列出动作

列出所有已创建的动作。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
only_global
boolean
Default: false

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    }
]

创建动作

按类型和名称创建新动作。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
One of
connector
required
string

由动作指定的连接器名称,用于选择外部资源。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用(是)或停用(否)此动作。

Array of actions_and_sources.fallback_action_republish (object) or actions_and_sources.fallback_action_reference (object)
Default: []

如果此操作的查询失败,将触发的回退操作列表。

name
required
string

资源名称。

required
object (bridge_greptimedb.action_parameters)
object (action_emqx_tables.action_resource_opts)
tags
Array of strings

连接器的标签

type
required
string
Value: "emqx_tables"

资源类型。

Responses

Request samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my action",
  • "enable": true,
  • "name": "my_action",
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "type": "azure_blob_storage"
}

Response samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my action",
  • "enable": true,
  • "node_status": [
    ],
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "status": "connected"
}

删除动作

按 ID 删除动作。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
also_delete_dep_actions
boolean
Default: false

是否级联删除依赖的动作。

ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string",
  • "rules": [
    ]
}

获取动作

按 ID 获取动作。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my action",
  • "enable": true,
  • "node_status": [
    ],
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "status": "connected"
}

更新动作

按 ID 更新动作。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string
Request Body schema: application/json
One of
connector
required
string

由动作指定的连接器名称,用于选择外部资源。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用(是)或停用(否)此动作。

Array of actions_and_sources.fallback_action_republish (object) or actions_and_sources.fallback_action_reference (object)
Default: []

如果此操作的查询失败,将触发的回退操作列表。

required
object (bridge_greptimedb.action_parameters)
object (action_emqx_tables.action_resource_opts)
tags
Array of strings

连接器的标签

Responses

Request samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my action",
  • "enable": true,
  • "parameters": {
    },
  • "resource_opts": {
    }
}

Response samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my action",
  • "enable": true,
  • "node_status": [
    ],
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "status": "connected"
}

集群动作启用

在集群所有节点启用或禁用动作。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

enable
required
boolean
Example: true

是否启用该数据桥接。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

获取动作指标

按 ID 获取动作指标。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "metrics": {
    },
  • "node_metrics": [
    ]
}

重置动作指标

按 ID 重置动作指标。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

集群动作操作

在集群所有节点启动动作。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

operation
required
string
Value: "start"
Example: start

集群可用操作:'启动'。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

测试动作创建

测试创建新动作。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
One of
connector
required
string

由动作指定的连接器名称,用于选择外部资源。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用(是)或停用(否)此动作。

Array of actions_and_sources.fallback_action_republish (object) or actions_and_sources.fallback_action_reference (object)
Default: []

如果此操作的查询失败,将触发的回退操作列表。

name
required
string

资源名称。

required
object (bridge_greptimedb.action_parameters)
object (action_emqx_tables.action_resource_opts)
tags
Array of strings

连接器的标签

type
required
string
Value: "emqx_tables"

资源类型。

Responses

Request samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my action",
  • "enable": true,
  • "name": "my_action",
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "type": "azure_blob_storage"
}

Response samples

Content type
application/json
{
  • "code": "TEST_FAILED",
  • "message": "string"
}

汇总动作

汇总动作

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
only_global
boolean
Default: false

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Authentication

为全局认证链上的指定认证器导入用户数据

为内置数据库认证器导入用户数据。

Authorizations:
basicAuthbearerAuth
query Parameters
type
required
string
Enum: "plain" "hash"
Example: type=hash

导入文件模板类型,枚举为 plain,hash

Request Body schema: application/json
object

Responses

Request samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Response samples

Content type
application/json
{
  • "failed": 0,
  • "override": 0,
  • "skipped": 0,
  • "success": 0,
  • "total": 0
}

获取指定认证器中的用户列表

获取内置数据库认证器中的用户列表。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

like_user_id
string

使用用户 ID (username 或 clientid)模糊查询。

is_superuser
boolean

是否是超级用户。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

向指定认证器添加用户

向内置数据库认证器添加用户数据。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
is_superuser
boolean
Default: false
namespace
string
password
required
string
user_id
required
string

Responses

Request samples

Content type
application/json
Example
{
  • "password": "******",
  • "user_id": "user1"
}

Response samples

Content type
application/json
Example
{
  • "user_id": "user1"
}

在指定认证器删除指定用户

删除内置数据库认证器中的指定用户数据。

Authorizations:
basicAuthbearerAuth
path Parameters
user_id
required
string

用户 ID,根据设置的账号类型不同,可以是 username 或 clientid

query Parameters
ns
string
Request Body schema: application/json
namespace
string

Responses

Request samples

Content type
application/json
{
  • "namespace": "ns1"
}

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

获取指定用户数据

获取内置数据库认证器中的指定用户数据。

Authorizations:
basicAuthbearerAuth
path Parameters
user_id
required
string

用户 ID,根据设置的账号类型不同,可以是 username 或 clientid

query Parameters
ns
string

Responses

Response samples

Content type
application/json
Example
{
  • "user_id": "user1"
}

更新指定用户数据

更新内置数据库认证器中的指定用户数据。

Authorizations:
basicAuthbearerAuth
path Parameters
user_id
required
string

用户 ID,根据设置的账号类型不同,可以是 username 或 clientid

query Parameters
ns
string
Request Body schema: application/json
is_superuser
boolean
Default: false
namespace
string
password
required
string

Responses

Request samples

Content type
application/json
Example
{
  • "password": "******"
}

Response samples

Content type
application/json
{
  • "regular_user": {
    },
  • "super_user": {
    }
}

Authorization

重置节点级别授权缓存

重置节点级别授权缓存。

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
{
  • "code": "INTERNAL_ERROR",
  • "message": "string"
}

清除内置数据库中的规则

清除内置数据库中的所有类型('users' 、'clients' 、'all')的所有规则

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

删除 'all' 规则

删除 'all' 规则

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "FORBIDDEN",
  • "message": "string"
}

列出适用于所有客户端规则

列出适用于所有客户端规则 (即 'all' 规则)。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "rules": [
    ]
}

创建或更新适用于所有客户端的规则

创建或更新适用于所有客户端的规则(即 'all' 规则)。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
Array of objects (emqx_authz_api_mnesia.rule_item)

Responses

Request samples

Content type
application/json
{
  • "rules": [
    ]
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

显示客户端的规则

显示客户端规则列表。

Authorizations:
basicAuthbearerAuth
query Parameters
page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

like_clientid
string

使用字串匹配模糊搜索客户端 ID

ns
string

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

为指定客户端添加规则'

为指定客户端添加规则。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
Array
clientid
required
string

客户端 ID

Array of objects (emqx_authz_api_mnesia.rule_item)

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

删除指定客户端的规则

删除指定客户端的规则

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Example: client1

客户端 ID

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

获取指定客户端的规则

获取指定客户端的规则

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Example: client1

客户端 ID

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "clientid": "client1",
  • "rules": [
    ]
}

设置指定客户端的规则

设置指定客户端的规则

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Example: client1

客户端 ID

query Parameters
ns
string
Request Body schema: application/json
clientid
required
string

客户端 ID

Array of objects (emqx_authz_api_mnesia.rule_item)

Responses

Request samples

Content type
application/json
{
  • "clientid": "client1",
  • "rules": [
    ]
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

显示用户名规则

显示用户名规则列表。

Authorizations:
basicAuthbearerAuth
query Parameters
page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

like_username
string

使用字串匹配模糊搜索用户名

ns
string

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

为指定的用户添加规则

为指定的用户添加规则。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
Array
Array of objects (emqx_authz_api_mnesia.rule_item)
username
required
string

用户名

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

删除指定用户名的规则'

删除指定用户名的规则

Authorizations:
basicAuthbearerAuth
path Parameters
username
required
string
Example: user1

用户名

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

获取指定用户名的规则

获取指定用户名规则

Authorizations:
basicAuthbearerAuth
path Parameters
username
required
string
Example: user1

用户名

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "rules": [
    ],
  • "username": "user1"
}

设置指定用户名的规则

设置指定用户名的规则

Authorizations:
basicAuthbearerAuth
path Parameters
username
required
string
Example: user1

用户名

query Parameters
ns
string
Request Body schema: application/json
Array of objects (emqx_authz_api_mnesia.rule_item)
username
required
string

用户名

Responses

Request samples

Content type
application/json
{
  • "rules": [
    ],
  • "username": "user1"
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

Banned

清除

清除全部黑名单数据。

Authorizations:
basicAuthbearerAuth

Responses

列出目前所有被封禁的客户端 ID、用户名和 IP 地址。

列出目前所有被封禁的客户端 ID、用户名和 IP 地址。

Authorizations:
basicAuthbearerAuth
query Parameters
page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

clientid
string

使用精确的客户端 ID 查询封禁规则。

username
string

使用精确的用户名查询封禁规则。

peerhost
string
Example: peerhost=127.0.0.1

使用精确的 IP 地址查询封禁规则。

like_clientid
string

使用客户端 ID 正则表达式来匹配查询封禁规则。

like_username
string

使用用户名正则表达式来匹配查询封禁规则。

like_peerhost
string
Example: like_peerhost=127.0.0.1

使用 IP 地址正则表达式来匹配查询封禁规则。

like_peerhost_net
string
Example: like_peerhost_net=192.1.0.0/16

使用 CIDR 正则表达式来匹配查询封禁规则。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

添加一个客户端 ID、用户名或者 IP 地址到黑名单。

添加一个客户端 ID、用户名或者 IP 地址到黑名单。

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
as
required
string
Enum: "clientid" "username" "peerhost" "clientid_re" "username_re" "peerhost_net"

封禁方式,可以通过客户端 ID、用户名或者 IP 地址等方式进行封禁。

integer or string

封禁的起始时间,格式为 rfc3339,默认为发起操作的时间。

by
string

封禁的发起者。

reason
string

封禁原因,记录当前对象被封禁的原因。

(integer or string) or string
Default: "infinity"

封禁的结束时间,格式为 rfc3339,默认值为发起操作的时间 + 1 年。

who
required
string

封禁对象,具体的客户端 ID、用户名或者 IP 地址。

Responses

Request samples

Content type
application/json
{
  • "as": "username",
  • "at": "2021-10-25T21:48:47+08:00",
  • "by": "mgmt_api",
  • "reason": "Too many requests",
  • "until": "2030-11-11T10:24:00+08:00",
  • "who": "Banned name"
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

将一个客户端 ID、用户名或者 IP 地址从黑名单中删除。

将一个客户端 ID、用户名或者 IP 地址从黑名单中删除。

Authorizations:
basicAuthbearerAuth
path Parameters
as
required
string
Enum: "clientid" "username" "peerhost" "clientid_re" "username_re" "peerhost_net"
Example: username

封禁方式,可以通过客户端 ID、用户名或者 IP 地址等方式进行封禁。

who
required
string
Example: Badass

封禁对象,具体的客户端 ID、用户名或者 IP 地址。

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

Clients

列出客户端

列出客户端

Authorizations:
basicAuthbearerAuth
query Parameters
page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

node
string
Example: node=emqx@127.0.0.1

节点名称

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

username
Array of strings

客户端连接时使用的用户名称。

ip_address
string
Example: ip_address=127.0.0.1

客户端的 IP 地址。

conn_state
string
Enum: "connected" "idle" "disconnected"

客户端的当前连接状态,可能的值包括:connected(已连接)、idle(空闲)、disconnected(已断开)。

clean_start
boolean

指示客户端是否使用全新的会话。

proto_ver
string

客户端使用的协议版本

like_clientid
string

模糊搜索 clientid 作为子字符串。

like_username
string

模糊搜索 username 作为子字符串。

integer or string

按大于或等于的方法搜索客户端会话创建时间,格式为 RFC3339 或时间戳(毫秒)。

integer or string

按小于或等于的方法搜索客户端会话创建时间,格式为 RFC3339 或时间戳(毫秒)。

integer or string

按大于或等于的方法搜索客户端连接创建时间,格式为 RFC3339 或时间戳(毫秒)。

integer or string

按小于或等于的方法搜索客户端连接创建时间,格式为 RFC3339 或时间戳(毫秒)。

clientid
Array of strings

客户端 ID。

Array of strings or string
Default: "all"

请求在响应中返回的客户端字段,多个字段以逗号分隔。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

列出客户端 (V2)

列出客户端

Authorizations:
basicAuthbearerAuth
query Parameters
cursor
string

表示当前迭代状态的不透明值。

node
string
Example: node=emqx@127.0.0.1

节点名称

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

username
Array of strings

客户端连接时使用的用户名称。

ip_address
string
Example: ip_address=127.0.0.1

客户端的 IP 地址。

conn_state
string
Enum: "connected" "idle" "disconnected"

客户端的当前连接状态,可能的值包括:connected(已连接)、idle(空闲)、disconnected(已断开)。

clean_start
boolean

指示客户端是否使用全新的会话。

proto_ver
string

客户端使用的协议版本

like_clientid
string

模糊搜索 clientid 作为子字符串。

like_username
string

模糊搜索 username 作为子字符串。

integer or string

按大于或等于的方法搜索客户端会话创建时间,格式为 RFC3339 或时间戳(毫秒)。

integer or string

按小于或等于的方法搜索客户端会话创建时间,格式为 RFC3339 或时间戳(毫秒)。

integer or string

按大于或等于的方法搜索客户端连接创建时间,格式为 RFC3339 或时间戳(毫秒)。

integer or string

按小于或等于的方法搜索客户端连接创建时间,格式为 RFC3339 或时间戳(毫秒)。

clientid
Array of strings

客户端 ID。

Array of strings or string
Default: "all"

请求在响应中返回的客户端字段,多个字段以逗号分隔。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

根据客户端 ID 批量踢除客户端

通过客户端 ID 批量踢出客户端

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
Array
string

Responses

Request samples

Content type
application/json
[
  • "emqx_clientid_985bb09d",
  • "emqx_clientid_211cc01c"
]

踢出指定客户端

踢出指定客户端

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string

Responses

Response samples

Content type
application/json
{
  • "code": "CLIENTID_NOT_FOUND",
  • "message": "string"
}

获取指定客户端信息

获取指定客户端的详细信息

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string

Responses

Response samples

Content type
application/json
{
  • "awaiting_rel_cnt": 0,
  • "awaiting_rel_max": 100,
  • "clean_start": true,
  • "clientid": "01",
  • "connected": true,
  • "connected_at": "2024-01-01T12:34:56.789+08:00",
  • "created_at": "2024-01-01T12:34:56.789+08:00",
  • "durable": false,
  • "enable_authn": true,
  • "expiry_interval": 0,
  • "heap_size": 610,
  • "inflight_cnt": 0,
  • "inflight_max": 32,
  • "ip_address": "127.0.0.1",
  • "is_bridge": false,
  • "is_persistent": false,
  • "keepalive": 60,
  • "listener": "tcp:default",
  • "mailbox_len": 0,
  • "mountpoint": "null",
  • "mqueue_dropped": 0,
  • "mqueue_len": 0,
  • "mqueue_max": 1000,
  • "node": "emqx@127.0.0.1",
  • "peerport": 52571,
  • "port": 52571,
  • "proto_name": "MQTT",
  • "proto_ver": 5,
  • "recv_cnt": 4,
  • "recv_msg": 0,
  • "recv_msg.dropped": 0,
  • "recv_msg.dropped.await_pubrel_timeout": 0,
  • "recv_msg.qos0": 0,
  • "recv_msg.qos1": 0,
  • "recv_msg.qos2": 0,
  • "recv_oct": 49,
  • "recv_pkt": 4,
  • "reductions": 6836,
  • "send_cnt": 4,
  • "send_msg": 0,
  • "send_msg.dropped": 0,
  • "send_msg.dropped.expired": 0,
  • "send_msg.dropped.queue_full": 0,
  • "send_msg.dropped.too_large": 0,
  • "send_msg.qos0": 0,
  • "send_msg.qos1": 0,
  • "send_msg.qos2": 0,
  • "send_oct": 31,
  • "send_pkt": 4,
  • "subscriptions_cnt": 1,
  • "subscriptions_max": "infinity",
  • "username": null
}

清除指定客户端的授权缓存

清除指定客户端的授权缓存。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string

Responses

Response samples

Content type
application/json
{
  • "code": "CLIENTID_NOT_FOUND",
  • "message": "string"
}

获取指定客户端的授权缓存

获取指定客户端的授权缓存

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string

Responses

Response samples

Content type
application/json
{
  • "access": "string",
  • "result": "allow",
  • "topic": "string",
  • "updated_time": 1687850712989
}

获取客户端未确认消息

获取客户端未确认消息。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
query Parameters
payload
string
Default: "base64"
Enum: "none" "base64" "plain"

客户端的 Inflight/MQueue 消息的 payload 编码格式。

max_payload_bytes
string
Default: "1MB"
Example: max_payload_bytes=32MB

客户端的未确认消息(inflight)/ 消息队列(mqueue)消息 payload 限制。
返回的所有消息总负载大小不会超过此值。
达到该限制时,响应中包含的消息数量可能少于 limit;meta.position 指向最后一条返回的消息,因此可以从该位置请求下一页来获取被省略的消息。
唯一的例外是当第一条消息的负载已超过限制时,在这种情况下,响应中仅返回该第一条消息。

string or string or string
Example: position=none

在 meta.position 中返回的不透明 token,可用于后续请求以获取下一批结果:?position={prev_response.meta.position}。
用于替代 page 参数以遍历高度动态的数据。可以省略或设置为 none 以获取第一批数据。
如果 meta.position 为 end_of_data,表示没有更多结果。不要在后续请求中发送 end_of_data。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

获取客户端消息队列中的消息

获取客户端消息队列中的消息。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
query Parameters
payload
string
Default: "base64"
Enum: "none" "base64" "plain"

客户端的 Inflight/MQueue 消息的 payload 编码格式。

max_payload_bytes
string
Default: "1MB"
Example: max_payload_bytes=32MB

客户端的未确认消息(inflight)/ 消息队列(mqueue)消息 payload 限制。
返回的所有消息总负载大小不会超过此值。
达到该限制时,响应中包含的消息数量可能少于 limit;meta.position 指向最后一条返回的消息,因此可以从该位置请求下一页来获取被省略的消息。
唯一的例外是当第一条消息的负载已超过限制时,在这种情况下,响应中仅返回该第一条消息。

string or string or string
Example: position=none

在 meta.position 中返回的不透明 token,可用于后续请求以获取下一批结果:?position={prev_response.meta.position}。
用于替代 page 参数以遍历高度动态的数据。可以省略或设置为 none 以获取第一批数据。
如果 meta.position 为 end_of_data,表示没有更多结果。不要在后续请求中发送 end_of_data。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

订阅

强制 broker 代表指定客户端添加订阅。
订阅直接安装在客户端通道中并在通道生命周期内保持,就像客户端发起的 SUBSCRIBE。
该操作设计上绕过 MQTT 授权(ACL)规则:REST API key / 控制台角色是授权边界,而非 broker 的 authorization 配置。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Request Body schema: application/json
nl
integer
Default: 0

MQTT No Local 选项,控制客户端是否接收自己发布的消息。

qos
integer [ 0 .. 2 ]
Default: 0

消息服务质量(QoS)

rap
integer
Default: 0

客户端是否按原始发布方式保留 MQTT 保留消息的 Retain 标志。

rh
integer
Default: 0

保留消息处理(Retain handling)。

topic
required
string

主题名称。

Responses

Request samples

Content type
application/json
{
  • "nl": 0,
  • "qos": 0,
  • "rap": 0,
  • "rh": 0,
  • "topic": "testtopic/#"
}

Response samples

Content type
application/json
{
  • "clientid": "emqx_clientid_xx128cdhfc",
  • "durable": false,
  • "nl": 0,
  • "node": "emqx@127.0.0.1",
  • "qos": 0,
  • "rap": 0,
  • "rh": 0,
  • "topic": "testtopic/1"
}

批量订阅

强制 broker 代表指定客户端一次性添加多个订阅。
每个订阅直接安装在客户端通道中并在通道生命周期内保持,就像客户端发起的 SUBSCRIBE。
该操作设计上绕过 MQTT 授权(ACL)规则:REST API key / 控制台角色是授权边界,而非 broker 的 authorization 配置。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Request Body schema: application/json
Array
nl
integer
Default: 0

MQTT No Local 选项,控制客户端是否接收自己发布的消息。

qos
integer [ 0 .. 2 ]
Default: 0

消息服务质量(QoS)

rap
integer
Default: 0

客户端是否按原始发布方式保留 MQTT 保留消息的 Retain 标志。

rh
integer
Default: 0

保留消息处理(Retain handling)。

topic
required
string

主题名称。

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
[
  • {
    }
]

获取客户端订阅

获取指定客户端的订阅列表

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string

Responses

Response samples

Content type
application/json
[
  • {
    }
]

取消订阅

强制 broker 代表指定客户端移除订阅。
该操作设计上绕过 MQTT 授权(ACL)规则:REST API key / 控制台角色是授权边界,而非 broker 的 authorization 配置。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Request Body schema: application/json
topic
string

主题名称。

Responses

Request samples

Content type
application/json
{
  • "topic": "testtopic/#"
}

Response samples

Content type
application/json
{
  • "code": "CLIENTID_NOT_FOUND",
  • "message": "string"
}

批量取消订阅

强制 broker 代表指定客户端一次性移除多个订阅。
该操作设计上绕过 MQTT 授权(ACL)规则:REST API key / 控制台角色是授权边界,而非 broker 的 authorization 配置。

Authorizations:
basicAuthbearerAuth
path Parameters
clientid
required
string
Request Body schema: application/json
Array
topic
string

主题名称。

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "code": "CLIENTID_NOT_FOUND",
  • "message": "string"
}

Connectors

列出所有连接器

列出所有创建的连接器。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
only_global
boolean
Default: false

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {},
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {},
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • [
    ],
  • {
    }
]

创建连接器

通过类型和名称创建一个新的连接器。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
One of
allow_auto_topic_creation
boolean
Default: false

设置为 true 以允许通过元数据获取请求自动创建 Kafka 主题。

bridge_kafka.auth_gssapi_kerberos (object) or bridge_kafka.auth_username_password (object) or bridge_kafka.auth_oauth_client_credentials (object) or string or string
Default: "none"

认证配置。
- none:无认证。
- msk_iam:使用 MSK IAM 认证。注意:这仅在 EMQX 运行在 EC2 实例上时有效。
- basic auth:简单的用户名和密码认证。
- kerberos:使用 Kerberos GSSAPI 认证。

bootstrap_hosts
required
string

用逗号分隔的 host[:port] 主机列表。默认端口号为 9092。

connect_timeout
string
Default: "5s"

建立 TCP 连接时的最大等待时长(若启用认证,这个等待时长也包含完成认证所需时间)。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用 (是) 或 停用 (否) 该连接器。

metadata_request_timeout
string
Default: "5s"

刷新元数据时最大等待时长。

min_metadata_refresh_interval
string
Default: "3s"

刷新 Kafka broker 和 Kafka 主题元数据段最短时间间隔。设置太小可能会增加 Kafka 压力。

name
required
string

连接器的名称

request_timeout
string
Default: "30s"

等待 Kafka 对挂起请求作出响应的最长时间。
超过该时间后,连接被视为失效并会重新建立。
注意:如果设置得太小,Kafka 可能已经接收了某个生产请求但确认被延迟;EMQX 重连后会重发这个已被接受的批次,可能导致消息重复,并给下游消费者带来过大的数据量。

object (bridge_kafka.connector_resource_opts)
object (bridge_kafka.socket_opts)
object (bridge_kafka.ssl_client_opts)
tags
Array of strings

连接器的标签

type
required
string
Value: "kafka_consumer"

连接器的类型。

Responses

Request samples

Content type
application/json
Example
{
  • "account_key": "******",
  • "account_name": "my_account_name",
  • "description": "My connector",
  • "enable": true,
  • "name": "my_connector",
  • "resource_opts": {
    },
  • "type": "azure_blob_storage"
}

Response samples

Content type
application/json
Example
{
  • "account_key": "******",
  • "account_name": "my_account_name",
  • "description": "My connector",
  • "enable": true,
  • "node_status": [
    ],
  • "resource_opts": {
    },
  • "status": "connected"
}

删除连接器

通过 id 删除一个连接器。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_connector

连接器 id。必须是 {type}:{name} 的格式。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

获取连接器

通过 id 获取一个连接器。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_connector

连接器 id。必须是 {type}:{name} 的格式。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
Example
{
  • "account_key": "******",
  • "account_name": "my_account_name",
  • "description": "My connector",
  • "enable": true,
  • "node_status": [
    ],
  • "resource_opts": {
    },
  • "status": "connected"
}

更新连接器

通过 id 更新一个连接器。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_connector

连接器 id。必须是 {type}:{name} 的格式。

query Parameters
ns
string
Request Body schema: application/json
One of
allow_auto_topic_creation
boolean
Default: false

设置为 true 以允许通过元数据获取请求自动创建 Kafka 主题。

bridge_kafka.auth_gssapi_kerberos (object) or bridge_kafka.auth_username_password (object) or bridge_kafka.auth_oauth_client_credentials (object) or string or string
Default: "none"

认证配置。
- none:无认证。
- msk_iam:使用 MSK IAM 认证。注意:这仅在 EMQX 运行在 EC2 实例上时有效。
- basic auth:简单的用户名和密码认证。
- kerberos:使用 Kerberos GSSAPI 认证。

bootstrap_hosts
required
string

用逗号分隔的 host[:port] 主机列表。默认端口号为 9092。

connect_timeout
string
Default: "5s"

建立 TCP 连接时的最大等待时长(若启用认证,这个等待时长也包含完成认证所需时间)。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用 (是) 或 停用 (否) 该连接器。

metadata_request_timeout
string
Default: "5s"

刷新元数据时最大等待时长。

min_metadata_refresh_interval
string
Default: "3s"

刷新 Kafka broker 和 Kafka 主题元数据段最短时间间隔。设置太小可能会增加 Kafka 压力。

request_timeout
string
Default: "30s"

等待 Kafka 对挂起请求作出响应的最长时间。
超过该时间后,连接被视为失效并会重新建立。
注意:如果设置得太小,Kafka 可能已经接收了某个生产请求但确认被延迟;EMQX 重连后会重发这个已被接受的批次,可能导致消息重复,并给下游消费者带来过大的数据量。

object (bridge_kafka.connector_resource_opts)
object (bridge_kafka.socket_opts)
object (bridge_kafka.ssl_client_opts)
tags
Array of strings

连接器的标签

Responses

Request samples

Content type
application/json
Example
{
  • "account_key": "******",
  • "account_name": "my_account_name",
  • "description": "My connector",
  • "enable": true,
  • "resource_opts": {
    }
}

Response samples

Content type
application/json
Example
{
  • "account_key": "******",
  • "account_name": "my_account_name",
  • "description": "My connector",
  • "enable": true,
  • "node_status": [
    ],
  • "resource_opts": {
    },
  • "status": "connected"
}

集群连接器启用

在集群的所有节点上启用或禁用连接器。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_connector

连接器 id。必须是 {type}:{name} 的格式。

enable
required
boolean
Example: true

是否启用此连接器。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

集群连接器操作

在集群的所有节点上启动连接器。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_connector

连接器 id。必须是 {type}:{name} 的格式。

operation
required
string
Value: "start"
Example: start

集群可用操作:'start'。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

测试连接器创建

测试创建一个新的连接器。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
One of
allow_auto_topic_creation
boolean
Default: false

设置为 true 以允许通过元数据获取请求自动创建 Kafka 主题。

bridge_kafka.auth_gssapi_kerberos (object) or bridge_kafka.auth_username_password (object) or bridge_kafka.auth_oauth_client_credentials (object) or string or string
Default: "none"

认证配置。
- none:无认证。
- msk_iam:使用 MSK IAM 认证。注意:这仅在 EMQX 运行在 EC2 实例上时有效。
- basic auth:简单的用户名和密码认证。
- kerberos:使用 Kerberos GSSAPI 认证。

bootstrap_hosts
required
string

用逗号分隔的 host[:port] 主机列表。默认端口号为 9092。

connect_timeout
string
Default: "5s"

建立 TCP 连接时的最大等待时长(若启用认证,这个等待时长也包含完成认证所需时间)。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用 (是) 或 停用 (否) 该连接器。

metadata_request_timeout
string
Default: "5s"

刷新元数据时最大等待时长。

min_metadata_refresh_interval
string
Default: "3s"

刷新 Kafka broker 和 Kafka 主题元数据段最短时间间隔。设置太小可能会增加 Kafka 压力。

name
required
string

连接器的名称

request_timeout
string
Default: "30s"

等待 Kafka 对挂起请求作出响应的最长时间。
超过该时间后,连接被视为失效并会重新建立。
注意:如果设置得太小,Kafka 可能已经接收了某个生产请求但确认被延迟;EMQX 重连后会重发这个已被接受的批次,可能导致消息重复,并给下游消费者带来过大的数据量。

object (bridge_kafka.connector_resource_opts)
object (bridge_kafka.socket_opts)
object (bridge_kafka.ssl_client_opts)
tags
Array of strings

连接器的标签

type
required
string
Value: "kafka_consumer"

连接器的类型。

Responses

Request samples

Content type
application/json
Example
{
  • "account_key": "******",
  • "account_name": "my_account_name",
  • "description": "My connector",
  • "enable": true,
  • "name": "my_connector",
  • "resource_opts": {
    },
  • "type": "azure_blob_storage"
}

Response samples

Content type
application/json
{
  • "code": "TEST_FAILED",
  • "message": "string"
}

Message Transformation

列出转换

列出转换

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

追加转换

向消息转换列表中添加新的转换

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
description
string
Default: ""

描述性文本。

enable
boolean
Default: true

是否启用此功能。

failure_action
required
string
Enum: "drop" "disconnect" "ignore"

转换失败时的动作。

object (message_transformation.log_failure)
name
required
string

转换名称。

Array of objects (message_transformation.operation)
Default: []

转换操作列表。

string or string or string or string or string
Default: {"type":"none"}

负载解码器配置。

string or string or string or string or string
Default: {"type":"none"}

负载编码器配置。

tags
Array of strings

连接器的标签

required
Array of strings or string

应用该转换的主题过滤器。

Responses

Request samples

Content type
application/json
{
  • "description": "my transformation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_transformation",
  • "operations": [
    ],
  • "payload_decoder": {
    },
  • "payload_encoder": {
    },
  • "tags": [
    ],
  • "topics": [
    ]
}

Response samples

Content type
application/json
{
  • "description": "my transformation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_transformation",
  • "operations": [
    ],
  • "payload_decoder": {
    },
  • "payload_encoder": {
    },
  • "tags": [
    ],
  • "topics": [
    ]
}

更新转换

更新一个转换

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
description
string
Default: ""

描述性文本。

enable
boolean
Default: true

是否启用此功能。

failure_action
required
string
Enum: "drop" "disconnect" "ignore"

转换失败时的动作。

object (message_transformation.log_failure)
name
required
string

转换名称。

Array of objects (message_transformation.operation)
Default: []

转换操作列表。

string or string or string or string or string
Default: {"type":"none"}

负载解码器配置。

string or string or string or string or string
Default: {"type":"none"}

负载编码器配置。

tags
Array of strings

连接器的标签

required
Array of strings or string

应用该转换的主题过滤器。

Responses

Request samples

Content type
application/json
{
  • "description": "my transformation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_transformation",
  • "operations": [
    ],
  • "payload_decoder": {
    },
  • "payload_encoder": {
    },
  • "tags": [
    ],
  • "topics": [
    ]
}

Response samples

Content type
application/json
{
  • "description": "my transformation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_transformation",
  • "operations": [
    ],
  • "payload_decoder": {
    },
  • "payload_encoder": {
    },
  • "tags": [
    ],
  • "topics": [
    ]
}

试运行转换

对输入数据进行转换测试

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
required
object (message_transformation_http_api.dryrun_input_message)
required
object (message_transformation.transformation)

Responses

Request samples

Content type
application/json
{
  • "message": {
    },
  • "transformation": {
    }
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

重新排序转换

重新排序所有的消息转换

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
order
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "order": [
    ]
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "duplicated": [
    ],
  • "message": "string",
  • "not_found": [
    ],
  • "not_reordered": [
    ]
}

删除转换

删除一个转换

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_transformation

转换名称

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

查找转换

查找一个转换

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_transformation

转换名称

Responses

Response samples

Content type
application/json
{
  • "description": "my transformation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_transformation",
  • "operations": [
    ],
  • "payload_decoder": {
    },
  • "payload_encoder": {
    },
  • "tags": [
    ],
  • "topics": [
    ]
}

启用/禁用转换

启用或停用一个特定的转换

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_transformation

转换名称

enable
required
boolean

启用或停用转换

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

获取转换指标

获取一个特定转换的指标

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_transformation

转换名称

Responses

Response samples

Content type
application/json
{
  • "metrics": {
    },
  • "node_metrics": [
    ]
}

重置转换指标

重置特定变换的指标

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_transformation

转换名称

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

Metrics

集群运行统计

当前监控(统计)数据,例如整个集群中的连接数和连接速率。

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
{
  • "actions_executed_rate": 0,
  • "actions_messages_rate": 0,
  • "cluster_sessions": 0,
  • "connections": 0,
  • "disconnected_durable_sessions": 0,
  • "dropped_msg_rate": 0,
  • "license_quota": 0,
  • "live_connections": 0,
  • "persisted_rate": 0,
  • "received_msg_rate": 0,
  • "retained_msg_count": 0,
  • "rules_matched_rate": 0,
  • "sent_msg_rate": 0,
  • "sessions_hist_hwmark": {
    },
  • "shared_subscriptions": 0,
  • "subscriptions": 0,
  • "subscriptions_durable": 0,
  • "topics": 0,
  • "transformation_failed_rate": 0,
  • "transformation_succeeded_rate": 0,
  • "validation_failed_rate": 0,
  • "validation_succeeded_rate": 0
}

节点运行统计

节点监控(统计)数据,例如指定节点上的连接数和连接速率。

Authorizations:
basicAuthbearerAuth
path Parameters
node
required
string
Example: emqx@127.0.0.1

节点名称

Responses

Response samples

Content type
application/json
{
  • "actions_executed_rate": 0,
  • "actions_messages_rate": 0,
  • "cluster_sessions": 0,
  • "connections": 0,
  • "disconnected_durable_sessions": 0,
  • "dropped_msg_rate": 0,
  • "license_quota": 0,
  • "live_connections": 0,
  • "node_uptime": 0,
  • "persisted_rate": 0,
  • "received_msg_rate": 0,
  • "retained_msg_count": 0,
  • "rules_matched_rate": 0,
  • "sent_msg_rate": 0,
  • "sessions_hist_hwmark": {
    },
  • "shared_subscriptions": 0,
  • "subscriptions": 0,
  • "subscriptions_durable": 0,
  • "topics": 0,
  • "transformation_failed_rate": 0,
  • "transformation_succeeded_rate": 0,
  • "validation_failed_rate": 0,
  • "validation_succeeded_rate": 0
}

Retainer

删除对应的消息

删除对应的消息

Authorizations:
basicAuthbearerAuth
path Parameters
topic
required
string

主题

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

指定主题查看保留消息

不支持主题通配符

Authorizations:
basicAuthbearerAuth
path Parameters
topic
required
string

主题

Responses

Response samples

Content type
application/json
{
  • "from_clientid": "string",
  • "from_username": "string",
  • "msgid": "string",
  • "payload": "string",
  • "publish_at": "string",
  • "qos": 0,
  • "topic": "string"
}

删除保留消息

删除所有保留消息

Authorizations:
basicAuthbearerAuth

Responses

查看保留消息列表

查看保留消息列表

Authorizations:
basicAuthbearerAuth
query Parameters
topic
string

主题过滤器,支持通配符,省略此项以匹配所有消息。

page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

Publish

发布单条信息

发布单条信息。

可能的 HTTP 状态码如下:

200: 消息被成功发送到至少一个订阅。

202: 没有匹配到任何订阅。

400: 消息编码错误,如非法主题,或 QoS 超出范围等。

503: 服务重启等过程中导致转发失败。

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
clientid
string
Deprecated
payload
required
string

MQTT 消息体.

payload_encoding
string
Default: "plain"
Enum: "plain" "base64"

MQTT 消息体的编码方式,可以是 base64 或 plain。当设置为 base64 时,消息在发布前会先被解码,可以用于发布二进制等数据。

object (emqx_mgmt_api_publish.message_properties)
qos
integer [ 0 .. 2 ]
Default: 0

QoS

retain
boolean
Default: false

保留消息,布尔型字段,用于表示该消息是否是保留消息。

topic
required
string

主题

Responses

Request samples

Content type
application/json
{
  • "clientid": "string",
  • "payload": "hello emqx api",
  • "payload_encoding": "plain",
  • "properties": {
    },
  • "qos": 0,
  • "retain": false,
  • "topic": "api/example/topic"
}

Response samples

Content type
application/json
{
  • "id": "string"
}

批量发布多条消息

批量发布多条消息。

可能的 HTTP 状态码如下:

200: 所有的消息都被成功发送到至少一个订阅。

202: 至少有一个消息没有匹配到任何订阅。

400: 至少有一个消息编码错误,如非法主题,或 QoS 超出范围等。

503: 至少有一个小因为服务重启的原因导致转发失败。


请求的 Body 或者 Body 中包含的某个消息无法通过 API 规范的类型检查时,HTTP 响应的消息与发布单个消息的 API
/publish 是一样的。
如果所有的消息都是合法的,那么 HTTP 返回的内容是一个 JSON 数组,每个元素代表了该消息转发的状态。

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
Array
clientid
string
Deprecated
payload
required
string

MQTT 消息体.

payload_encoding
string
Default: "plain"
Enum: "plain" "base64"

MQTT 消息体的编码方式,可以是 base64 或 plain。当设置为 base64 时,消息在发布前会先被解码,可以用于发布二进制等数据。

object (emqx_mgmt_api_publish.message_properties)
qos
integer [ 0 .. 2 ]
Default: 0

QoS

retain
boolean
Default: false

保留消息,布尔型字段,用于表示该消息是否是保留消息。

topic
required
string

主题

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
[
  • {
    }
]

Rules

列出所有能被规则使用的事件

列出所有能被规则使用的事件

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
{
  • "columns": { },
  • "description": "some desc",
  • "event": "$events/sys/alarm_activated",
  • "sql_example": "string",
  • "test_columns": { },
  • "title": "some title"
}

列出所有规则

列出所有规则

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
only_global
boolean
Default: false
enable
boolean

根据规则是否开启条件过滤

from
string

根据规则来源 Topic 过滤, 需要完全匹配

like_id
string

根据规则 id 过滤, 使用子串模糊匹配

like_from
string

根据规则来源 Topic 过滤, 使用子串模糊匹配

like_description
string

根据规则描述过滤, 使用子串模糊匹配

match_from
string

根据规则来源 Topic 过滤, 使用 MQTT Topic 匹配

action
Array of strings

筛选包含任意给定动作 ID 的规则。当与 source ID 筛选一起使用时,规则必须包含匹配某些条件的 source 和动作。

source
Array of strings

筛选包含任意给定 source ID 的规则。当与动作 ID 筛选一起使用时,规则必须包含匹配某些条件的 source 和动作。

page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "meta": {
    }
}

通过指定 ID 创建规则

通过指定 ID 创建规则

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
Array of rule_engine.user_provided_function (object) or rule_engine.builtin_action_console (object) or rule_engine.builtin_action_republish (object) or strings
Default: []

规则的动作列表。
动作可以是指向 EMQX 数据桥接的引用,也可以是一个指向函数的对象。
我们支持一些内置函数,如“republish”和“console”,我们还支持用户提供的函数,它的格式为:“{module}:{function}”。
列表中的动作按顺序执行。这意味着如果其中一个动作执行缓慢,则以下所有动作都不会被执行直到它返回。
如果其中一个动作崩溃,在它之后的所有动作仍然会被按照原始顺序执行。
如果运行动作时出现任何错误,则会出现错误消息,并且相应的计数器会增加。

description
string
Default: ""

规则的描述

enable
boolean
Default: true

启用或禁用规则引擎

metadata
object

规则的元数据,不要手动修改

name
string
Default: ""

规则名字

sql
required
string

用于处理消息的 SQL 。
示例:SELECT * FROM "test/topic" WHERE payload.x = 1

Responses

Request samples

Content type
application/json
{
  • "actions": [
    ],
  • "description": "Some description",
  • "enable": true,
  • "metadata": { },
  • "name": "foo",
  • "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}

Response samples

Content type
application/json
{
  • "action_details": [
    ],
  • "actions": [
    ],
  • "created_at": "2021-12-01T15:00:43.153+08:00",
  • "description": "Some description",
  • "enable": true,
  • "from": "t/#",
  • "id": "293fb66f",
  • "last_modified_at": "2021-12-24T15:00:44.153+08:00",
  • "metadata": { },
  • "name": "foo",
  • "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}

基于给定 ID 新建一条规则

通过 ID 删除集群里所有节点上的规则

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: my_rule_id
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

查询规则

通过 ID 查询规则

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: my_rule_id
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "action_details": [
    ],
  • "actions": [
    ],
  • "created_at": "2021-12-01T15:00:43.153+08:00",
  • "description": "Some description",
  • "enable": true,
  • "from": "t/#",
  • "id": "293fb66f",
  • "last_modified_at": "2021-12-24T15:00:44.153+08:00",
  • "metadata": { },
  • "name": "foo",
  • "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}

更新集群规则

通过 ID 更新集群里所有节点上的规则

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: my_rule_id
query Parameters
ns
string
Request Body schema: application/json
Array of rule_engine.user_provided_function (object) or rule_engine.builtin_action_console (object) or rule_engine.builtin_action_republish (object) or strings
Default: []

规则的动作列表。
动作可以是指向 EMQX 数据桥接的引用,也可以是一个指向函数的对象。
我们支持一些内置函数,如“republish”和“console”,我们还支持用户提供的函数,它的格式为:“{module}:{function}”。
列表中的动作按顺序执行。这意味着如果其中一个动作执行缓慢,则以下所有动作都不会被执行直到它返回。
如果其中一个动作崩溃,在它之后的所有动作仍然会被按照原始顺序执行。
如果运行动作时出现任何错误,则会出现错误消息,并且相应的计数器会增加。

description
string
Default: ""

规则的描述

enable
boolean
Default: true

启用或禁用规则引擎

metadata
object

规则的元数据,不要手动修改

name
string
Default: ""

规则名字

sql
required
string

用于处理消息的 SQL 。
示例:SELECT * FROM "test/topic" WHERE payload.x = 1

Responses

Request samples

Content type
application/json
{
  • "actions": [
    ],
  • "description": "Some description",
  • "enable": true,
  • "metadata": { },
  • "name": "foo",
  • "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}

Response samples

Content type
application/json
{
  • "action_details": [
    ],
  • "actions": [
    ],
  • "created_at": "2021-12-01T15:00:43.153+08:00",
  • "description": "Some description",
  • "enable": true,
  • "from": "t/#",
  • "id": "293fb66f",
  • "last_modified_at": "2021-12-24T15:00:44.153+08:00",
  • "metadata": { },
  • "name": "foo",
  • "sql": "SELECT * FROM \"test/topic\" WHERE payload.x = 1"
}

获得指标数据

通过给定的 Id 获得规则的指标数据

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: my_rule_id
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "id": "293fb66f",
  • "metrics": {
    },
  • "node_metrics": [
    ]
}

重置规则计数

重置规则计数

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: my_rule_id
query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

执行规则

依据指定的消息内容和运行环境执行相应的规则。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: my_rule_id
query Parameters
ns
string
Request Body schema: application/json
rule_engine.ctx_unsub (object) or rule_engine.ctx_sub (object) or rule_engine.ctx_schema_validation_failed (object) or rule_engine.ctx_message_transformation_failed (object) or rule_engine.ctx_pub (object) or rule_engine.ctx_dropped (object) or rule_engine.ctx_delivered (object) or rule_engine.ctx_acked (object) or rule_engine.ctx_delivery_dropped (object) or rule_engine.ctx_ping (object) or rule_engine.ctx_disconnected (object) or rule_engine.ctx_connected (object) or rule_engine.ctx_connack (object) or rule_engine.ctx_check_authz_complete (object) or rule_engine.ctx_check_authn_complete (object) or rule_engine.ctx_alarm_deactivated (object) or rule_engine.ctx_alarm_activated (object) or rule_engine.ctx_bridge_mqtt (object)
Default: {}

测试事件的上下文

stop_action_after_template_rendering
boolean
Default: true

如果操作在模板渲染后应该停止,请将此设置为 true(默认为 true)。

Responses

Request samples

Content type
application/json
{
  • "context": { },
  • "stop_action_after_template_rendering": true
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

Schema Registry

列出 schema

列出所有已注册的 schema。

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

注册 schema

注册一个新的 schema。

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
One of
description
string
Default: ""

改 schema 的描述。

name
required
string

Schema 的一个名称,将用作其标识符。

required
object (schema_registry.external_http_params)
type
required
string
Value: "external_http"

对于外部 HTTP,必须设置为 external_http。

Responses

Request samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "name": "my_avro_schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

Response samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "name": "my_avro_schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

删除 schema

删除一个 schema。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_schema

Schema 的名称。

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

获取 schema

通过名称获取一个 schema。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_schema

Schema 的名称。

Responses

Response samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "name": "my_avro_schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

更新 schema

更新一个现有的 schema。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_schema

Schema 的名称。

Request Body schema: application/json
One of
description
string
Default: ""

改 schema 的描述。

required
object (schema_registry.external_http_params)
type
required
string
Value: "external_http"

对于外部 HTTP,必须设置为 external_http。

Responses

Request samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

Response samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "name": "my_avro_schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

创建 Protobuf Bundle

为新 Schema 上传 Protobuf 包

Authorizations:
basicAuthbearerAuth
Request Body schema: multipart/form-data
bundle
string <binary>
description
string
name
string
root_proto_file
string

Responses

Response samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "name": "my_avro_schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

更新 Protobuf Bundle

为现有 Schema 上传 Protobuf 包

Authorizations:
basicAuthbearerAuth
Request Body schema: multipart/form-data
bundle
string <binary>
description
string
name
string
root_proto_file
string

Responses

Response samples

Content type
application/json
{
  • "description": "My Avro Schema",
  • "source": "{\"type\":\"record\",\"name\":\"test\",\"fields\":[{\"type\":\"int\",\"name\":\"i\"},{\"type\":\"string\",\"name\":\"s\"}]}",
  • "type": "avro"
}

Schema Validation

列出校验

列出验证规则。

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

追加校验

在验证规则列表中添加新的验证规则。

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
required
Array of schema_validation.check_external_http (object) or schema_validation.check_protobuf (object) or schema_validation.check_avro (object) or schema_validation.check_json (object) or schema_validation.check_sql (object)

在验证过程中将执行的检查。它们将按照定义的顺序进行评估。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

是否启用此功能。

failure_action
required
string
Enum: "drop" "disconnect" "ignore"

如果验证失败,将如何处理。

drop:违规消息将被直接丢弃,不进行进一步处理。
disconnect:消息不会被发布,发布客户端将被断开连接。
ignore:仅记录和追踪失败,不采取其他行动。

object (schema_validation.log_failure)
name
required
string

此校验的名称。在所有校验中必须唯一。只能使用字母、数字和下划线的组合,且不能以数字或下划线开头。

strategy
required
string
Enum: "any_pass" "all_pass"

校验如何判定检查是否成功。

all_pass:所有检查都会执行且必须全部通过。
any_pass:任一检查通过即可。遇到第一个成功即停止。

tags
Array of strings

连接器的标签

required
Array of strings or string

此验证规则应验证的单个主题过滤器或主题过滤器列表。

Responses

Request samples

Content type
application/json
Example
{
  • "checks": [
    ],
  • "description": "my validation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_validation",
  • "strategy": "all_pass",
  • "tags": [
    ],
  • "topics": [
    ]
}

Response samples

Content type
application/json
Example
{
  • "checks": [
    ],
  • "description": "my validation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_validation",
  • "strategy": "all_pass",
  • "tags": [
    ],
  • "topics": [
    ]
}

更新校验

更新一条验证规则。

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
required
Array of schema_validation.check_external_http (object) or schema_validation.check_protobuf (object) or schema_validation.check_avro (object) or schema_validation.check_json (object) or schema_validation.check_sql (object)

在验证过程中将执行的检查。它们将按照定义的顺序进行评估。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

是否启用此功能。

failure_action
required
string
Enum: "drop" "disconnect" "ignore"

如果验证失败,将如何处理。

drop:违规消息将被直接丢弃,不进行进一步处理。
disconnect:消息不会被发布,发布客户端将被断开连接。
ignore:仅记录和追踪失败,不采取其他行动。

object (schema_validation.log_failure)
name
required
string

此校验的名称。在所有校验中必须唯一。只能使用字母、数字和下划线的组合,且不能以数字或下划线开头。

strategy
required
string
Enum: "any_pass" "all_pass"

校验如何判定检查是否成功。

all_pass:所有检查都会执行且必须全部通过。
any_pass:任一检查通过即可。遇到第一个成功即停止。

tags
Array of strings

连接器的标签

required
Array of strings or string

此验证规则应验证的单个主题过滤器或主题过滤器列表。

Responses

Request samples

Content type
application/json
{
  • "checks": [
    ],
  • "description": "my validation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_validation",
  • "strategy": "all_pass",
  • "tags": [
    ],
  • "topics": [
    ]
}

Response samples

Content type
application/json
{
  • "checks": [
    ],
  • "description": "my validation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_validation",
  • "strategy": "all_pass",
  • "tags": [
    ],
  • "topics": [
    ]
}

重新排序校验

重新排序所有验证规则

Authorizations:
basicAuthbearerAuth
Request Body schema: application/json
order
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "order": [
    ]
}

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "duplicated": [
    ],
  • "message": "string",
  • "not_found": [
    ],
  • "not_reordered": [
    ]
}

删除校验

删除一条验证规则。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_validation

验证规则名称

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

查找校验

查找一条验证规则

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_validation

验证规则名称

Responses

Response samples

Content type
application/json
Example
{
  • "checks": [
    ],
  • "description": "my validation",
  • "enable": true,
  • "failure_action": "drop",
  • "log_failure": {
    },
  • "name": "my_validation",
  • "strategy": "all_pass",
  • "tags": [
    ],
  • "topics": [
    ]
}

启用/禁用校验

启用或停用某个特定验证规则。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_validation

验证规则名称

enable
required
boolean

启用或停用验证规则。

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

获取校验指标

获取某个特定验证规则的指标。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_validation

验证规则名称

Responses

Response samples

Content type
application/json
{
  • "metrics": {
    },
  • "node_metrics": [
    ]
}

重置校验指标

重置某个特定验证规则的指标。

Authorizations:
basicAuthbearerAuth
path Parameters
name
required
string
Example: my_validation

验证规则名称

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

Sources

列出数据源类型

列出所有可用的数据源类型。

Authorizations:
basicAuthbearerAuth

Responses

Response samples

Content type
application/json
[
  • "mqtt",
  • "kafka_consumer",
  • "gcp_pubsub_consumer",
  • "rabbitmq"
]

列出 Source

列出所有已创建的 Source。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
only_global
boolean
Default: false

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    },
  • {
    },
  • {
    }
]

创建 Source

按类型和名称创建新 Source。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
One of
connector
required
string

由动作指定的连接器名称,用于选择外部资源。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用(是)或停用(否)此动作。

name
required
string

资源名称。

required
object (bridge_rabbitmq.source_parameters)
object (actions_and_sources.source_resource_opts)
tags
Array of strings

连接器的标签

type
required
string
Value: "rabbitmq"

资源类型。

Responses

Request samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my source",
  • "enable": true,
  • "name": "my_action",
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "type": "gcp_pubsub_consumer"
}

Response samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my source",
  • "enable": true,
  • "node_status": [
    ],
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "status": "connected"
}

删除 Source

按 ID 删除 Source。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
also_delete_dep_actions
boolean
Default: false

是否级联删除依赖的动作。

ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string",
  • "rules": [
    ]
}

获取 Source

按 ID 获取 Source。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my source",
  • "enable": true,
  • "node_status": [
    ],
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "status": "connected"
}

更新 Source

按 ID 更新 Source。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string
Request Body schema: application/json
One of
connector
required
string

由动作指定的连接器名称,用于选择外部资源。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用(是)或停用(否)此动作。

required
object (bridge_rabbitmq.source_parameters)
object (actions_and_sources.source_resource_opts)
tags
Array of strings

连接器的标签

Responses

Request samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my source",
  • "enable": true,
  • "parameters": {
    },
  • "resource_opts": {
    }
}

Response samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my source",
  • "enable": true,
  • "node_status": [
    ],
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "status": "connected"
}

集群 Source 启用

在集群所有节点启用或禁用 Source。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

enable
required
boolean
Example: true

是否启用该数据桥接。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

获取 Source 指标

按 ID 获取 Source 指标。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "metrics": {
    },
  • "node_metrics": [
    ]
}

重置 Source 指标

按 ID 重置 Source 指标。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "NOT_FOUND",
  • "message": "string"
}

集群 Source 操作

在集群所有节点启动 Source。

Authorizations:
basicAuthbearerAuth
path Parameters
id
required
string
Example: http:my_http_action

数据桥接 ID,格式必须为 {type}:{name}。

operation
required
string
Value: "start"
Example: start

集群可用操作:'启动'。

query Parameters
ns
string

Responses

Response samples

Content type
application/json
{
  • "code": "BAD_REQUEST",
  • "message": "string"
}

测试 Source 创建

测试创建新 Source。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
Request Body schema: application/json
One of
connector
required
string

由动作指定的连接器名称,用于选择外部资源。

description
string
Default: ""

描述性文本。

enable
boolean
Default: true

启用(是)或停用(否)此动作。

name
required
string

资源名称。

required
object (bridge_rabbitmq.source_parameters)
object (actions_and_sources.source_resource_opts)
tags
Array of strings

连接器的标签

type
required
string
Value: "rabbitmq"

资源类型。

Responses

Request samples

Content type
application/json
Example
{
  • "connector": "my_connector",
  • "description": "my source",
  • "enable": true,
  • "name": "my_action",
  • "parameters": {
    },
  • "resource_opts": {
    },
  • "type": "gcp_pubsub_consumer"
}

Response samples

Content type
application/json
{
  • "code": "TEST_FAILED",
  • "message": "string"
}

汇总 Source

汇总 Source。

Authorizations:
basicAuthbearerAuth
query Parameters
ns
string
only_global
boolean
Default: false

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Subscriptions

获取订阅列表

获取集群的订阅列表。

Authorizations:
basicAuthbearerAuth
query Parameters
page
integer >= 1
Default: 1
Example: page=1

要获取的结果所在页码。

limit
integer [ 1 .. 10000 ]
Default: 100
Example: limit=50

每页返回的结果数量。

node
string
Example: node=emqx@127.0.0.1

节点名称。

clientid
string

客户端 ID。

qos
integer [ 0 .. 2 ]
Example: qos=0

QoS。

topic
string

主题,URL 编码。

match_topic
string

匹配主题字符串,URL 编码。

share_group
string

共享订阅组名称。

durable
boolean

按持久性过滤订阅。

Responses

Response samples

Content type
application/json
[
  • {
    }
]