资源类型

查询规则引擎的资源类型。注意资源类型只能由 emqx 提供,不能添加。

GET api/v4/resource_types/{resource_type_name}

获取某个资源的详情,包括资源描述、参数列表等。

Path Parameters:

NameTypeRequiredDescription
resource_type_nameStringFalse可选,资源类型名。如不指定 resource_type_name 则
以数组形式返回当前支持的所有资源类型。

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataObject规则对象
- data.titleObject资源类型的简述,中英文。
- data.paramsObject资源类型的参数列表。参数以 key-value 形式表示。
详情可参看后面的示例
- data.descriptionObject资源类型的描述信息,中英文。
- data.providerString资源类型的提供者

Examples:

查询 web_hook 资源类型的详细信息:

  1. $ curl --basic -u admin:public 'http://localhost:8081/api/v4/resource_types/web_hook'
  2. {"data":{"title":{"zh":"WebHook","en":"WebHook"},"provider":"emqx_web_hook","params":{"url":{"type":"string","title":{"zh":"请求 URL","en":"Request URL"},"required":true,"format":"url","description":{"zh":"请求 URL","en":"Request URL"}},"method":{"type":"string","title":{"zh":"请求方法","en":"Request Method"},"enum":["PUT","POST"],"description":{"zh":"请求方法","en":"Request Method"},"default":"POST"},"headers":{"type":"object","title":{"zh":"请求头","en":"Request Header"},"schema":{},"description":{"zh":"请求头","en":"Request Header"},"default":{}}},"name":"web_hook","description":{"zh":"WebHook","en":"WebHook"}},"code":0}

查询当前所有的资源类型:

  1. $ curl --basic -u admin:public 'http://localhost:8081/api/v4/resource_types'
  2. {"data":[{"title":{"zh":"WebHook","en":"WebHook"},"provider":"emqx_web_hook","params":{"url":{"type":"string","title":{"zh":"请求 URL","en":"Request URL"},"required":true,"format":"url","description":{"zh":"请求 URL","en":"Request URL"}},"method":{"type":"string","title":{"zh":"请求方法","en":"Request Method"},"enum":["PUT","POST"],"description":{"zh":"请求方法","en":"Request Method"},"default":"POST"},"headers":{"type":"object","title":{"zh":"请求头","en":"Request Header"},"schema":{},"description":{"zh":"请求头","en":"Request Header"},"default":{}}},"name":"web_hook","description":{"zh":"WebHook","en":"WebHook"}}, ...],"code":0}