[comment]: # translation:outdated

[comment]: # ({49f9e765-49f9e765})
# 创建

[comment]: # ({/49f9e765-49f9e765})

[comment]: # ({641d8b86-c66bc66b})
### 描述

`object triggerprototype.create(object/array triggerPrototypes)`

此方法用于创建新的触发器原型。

::: noteclassic
此方法仅适用于 *Admin* 和 *Super admin*
用户类型。调用该方法的权限可在用户角色设置中被撤销。更多信息请参见 [用户角色](/manual/web_interface/frontend_sections/users/user_roles)。
:::

[comment]: # ({/641d8b86-c66bc66b})

[comment]: # ({438d4089-e93145a6})
### 参数

`(object/array)` 要创建的触发器原型。

除了[标准触发器原型属性](object#trigger-prototype)之外，该方法还接受以下参数。

|参数|[Type](/manual/api/reference_commentary#data-types)|描述|
|--|--|------|
|dependencies|array|该触发器原型所依赖的[触发器](/manual/api/reference/trigger/object#trigger)和[触发器原型](/manual/api/reference/triggerprototype/object#trigger-prototype)。<br><br>这些触发器必须仅定义 `triggerid` 属性。|
|tags|array|[触发器原型标签](/manual/api/reference/triggerprototype/object#trigger-prototype-tag)。|

[comment]: # ({/438d4089-e93145a6})

[comment]: # ({8d1f4c4d-8d1f4c4d})
### 返回值

`(object)`返回一个对象，该对象包含在`triggerids`属性中已创建触发器原型的ID，返回ID的顺序与传递触发器原型的顺序相匹配.

[comment]: # ({/8d1f4c4d-8d1f4c4d})

[comment]: # ({b41637d2-b41637d2})
### 示例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({b17d7ba1-87a61295})
#### 创建触发器原型

创建一个触发器原型，用于检测文件系统的可用磁盘空间是否低于
20%。

[请求](/manual/api#performing-requests)：

```json
{
    "jsonrpc": "2.0",
    "method": "triggerprototype.create",
    "params": {
        "description": "卷 {#FSNAME} 的可用磁盘空间低于 20%",
        "expression": "last(/Zabbix server/vfs.fs.size[{#FSNAME},pfree])<20",
        "tags": [
            {
                "tag": "volume",
                "value": "{#FSNAME}"
            },
            {
                "tag": "type",
                "value": "{#FSTYPE}"
            }
        ]
    },
    "id": 1
}
```

响应：

```json
{
    "jsonrpc": "2.0",
    "result": {
        "triggerids": [
            "17372"
        ]
    },
    "id": 1
}
```

[comment]: # ({/b17d7ba1-87a61295})

[comment]: # ({43cf23db-43cf23db})
### 源码

CTriggerPrototype::create() in
*ui/include/classes/api/services/CTriggerPrototype.php*.

[comment]: # ({/43cf23db-43cf23db})
