Skip to content

Templates API

Template endpoints 用于管理 project 的 root template、groups、topics 和 rules。

GET /api/v2/projects/:fullname/templates

返回 project templates。

参数:

参数位置说明
fullnamePathProject fullname。

Payload: 无。

响应:ProjectTemplate[]

GET /api/v2/projects/:fullname/template

返回 project root template。

参数:

参数位置说明
fullnamePathProject fullname。

Payload: 无。

响应:ProjectTemplate,或 not found。

POST /api/v2/projects/:fullname/templates

为 project 创建 template/group。

参数:

参数位置说明
fullnamePathProject fullname。

Payload:

字段必填说明
projectProject fullname。
schemaTemplate inputs schema。
groupsTemplate groups 数组。
topicsTopics 数组。
rules将 topics 绑定到 triggers 的 rules 数组。
meta.titleTemplate title。
meta.descriptionTemplate description。

响应:ProjectTemplate

GET /api/v2/projects/:fullname/templates/:id

返回 template。

参数:

参数位置说明
fullnamePathProject fullname。
idPathTemplate id。

Payload: 无。

响应:ProjectTemplate

PUT /api/v2/projects/:fullname/templates/:id

更新 template。

参数:

参数位置说明
fullnamePathProject fullname。
idPathTemplate id。

Payload: 与 POST /api/v2/projects/:fullname/templates 相同结构。

响应:ProjectTemplate

DELETE /api/v2/projects/:fullname/templates/:id

删除 template。

参数:

参数位置说明
fullnamePathProject fullname。
idPathTemplate id。

Payload: 无。

响应:OperationResult

Template Payload Details

groups

每个 group:

字段必填说明
nameGroup name。
meta.title可见标题。
meta.description描述。

topics

每个 topic:

字段必填说明
nameTopic name。
groupGroup name/fullname。
selectedByDefaultTopic 是否在 subscription wizard 中默认选中。
meta.title可见标题。
meta.description描述。

rules

每个 rule:

字段必填说明
idRule id。
triggerTrigger fullname。
topicTopic name。
inputsStatic input mapping 或 null
policy`{ type: "filter"
conditionsConditions object 或 null
deprecatedRule 是否 deprecated。
requiredValues此 rule 需要的 input keys。