[comment]: # translation:outdated

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

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

[comment]: # ({3828a4c3-378ed58d})
### 描述

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

这个方法可以创建新的触发器原型。

[comment]: # ({/3828a4c3-378ed58d})

[comment]: # ({171050be-e93145a6})
### 参数

`(object/array)`需要创建的触发器原型。 除[standard trigger prototype
properties](object#trigger_prototype)之外，此方法还接受以下参数。

|参数           类|说明|<|
|--------------------|------|-|
|dependencies|array|依赖触发器原型的触发器和触发器原型。<br><br>触发器必须已定义`triggerid`属性。|
|tags|array|触发器原型标签。|

<note
important>指定的触发器表达式必须为展开式，并且必须包含至少一个监控项原型。
:::

[comment]: # ({/171050be-e93145a6})

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

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

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

[comment]: # ({392bbd85-b41637d2})
### 范例

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

[comment]: # ({e2cd18cd-e858a821})
#### 创建触发器原型

创建一个触发器原型来检测磁盘剩余空间是否小于20%。

请求:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "triggerprototype.create",
    "params": {
        "description": "Free disk space is less than 20% on volume {#FSNAME}",
        "expression": "{Zabbix server:vfs.fs.size[{#FSNAME},pfree].last()}<20",
        "tags": [
            {
                "tag": "volume",
                "value": "{#FSNAME}"
            },
            {
                "tag": "type",
                "value": "{#FSTYPE}"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

响应:

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

[comment]: # ({/e2cd18cd-e858a821})

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

CTriggerPrototype::create()方法可在*frontends/php/include/classes/api/services/CTriggerPrototype.php*中参考。

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