资源类型
查询规则引擎的资源类型。注意资源类型只能由 emqx 提供,不能添加。
GET api/v4/resource_types/{resource_type_name}
获取某个动作的详情,包括动作名字、参数列表等。
Path Parameters:
Name | Type | Required | Description |
---|---|---|---|
resource_type_name | String | False | 可选,资源类型名。如不指定 resource_type_name 则 以数组形式返回当前支持的所有资源类型。 |
Success Response Body (JSON):
Name | Type | Description |
---|---|---|
code | Integer | 0 |
data | Object | 规则对象 |
- data.title | Object | 资源类型的简述,中英文。 |
- data.params | Object | 资源类型的参数列表。参数以 key-value 形式表示。 详情可参看后面的示例 |
- data.description | Object | 资源类型的描述信息,中英文。 |
- data.provider | String | 资源类型的提供者 |
Examples:
查询 web_hook 资源类型的详细信息:
$ curl --basic -u admin:public 'http://localhost:8081/api/v4/resource_types/web_hook'
{"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}
查询当前所有的资源类型:
$ curl --basic -u admin:public 'http://localhost:8081/api/v4/resource_types'
{"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}