integer/array templategroup.get(object parameters)
该方法允许根据给定的参数检索模板组。
此方法适用于任何类型的用户。可以在用户角色设置中撤销调用此方法的权限。更多信息请参见 User roles。
(object) 参数定义了期望的输出。
该方法支持以下参数。
| 参数 | 数据类型 | 描述 |
|---|---|---|
| graphids | ID/array | 仅返回包含具有指定图表模板的模板组。 |
| groupids | ID/array | 仅返回具有指定模板组ID的模板组。 |
| templateids | ID/array | 仅返回包含指定模板的模板组。 |
| triggerids | ID/array | 仅返回包含具有指定触发器模板的模板组。 |
| with_graphs | flag | 仅返回包含具有图表模板的模板组。 |
| with_graph_prototypes | flag | 仅返回包含具有图表原型模板的模板组。 |
| with_httptests | flag | 仅返回包含具有Web检测模板的模板组。 |
| with_items | flag | 仅返回包含具有监控项模板的模板组。 覆盖 with_simple_graph_items 参数。 |
| with_item_prototypes | flag | 仅返回包含具有监控项原型模板的模板组。 覆盖 with_simple_graph_item_prototypes 参数。 |
| with_simple_graph_item_prototypes | flag | 仅返回包含具有监控项原型模板的模板组,这些模板已启用创建且信息类型为数值型。 |
| with_simple_graph_items | flag | 仅返回包含具有数值型监控项模板的模板组。 |
| with_templates | flag | 仅返回包含模板的模板组。 |
| with_triggers | flag | 仅返回包含具有触发器模板的模板组。 |
| selectTemplates | query | 返回一个包含属于该模板组模板的 templates 属性。支持 count。 |
| limitSelects | integer | 限制子查询返回的记录数。 适用于以下子查询: selectTemplates - 结果将按 template 排序。 |
| sortfield | string/array | 按照给定属性对结果进行排序。 可能的值: groupid、name。 |
| countOutput | boolean | 这些参数在 通用get方法参数 中有描述。 |
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
(integer/array) 返回以下之一:
countOutput 参数,则为检索到的 objects 的数量。检索名为 "Templates/Databases" 和 "Templates/Modules" 的两个模板组的所有数据。
执行请求:
{
"jsonrpc": "2.0",
"method": "templategroup.get",
"params": {
"output": "extend",
"filter": {
"name": [
"Templates/Databases",
"Templates/Modules"
]
}
},
"id": 1
}响应:
{
"jsonrpc": "2.0",
"result": [
{
"groupid": "13",
"name": "Templates/Databases",
"uuid": "748ad4d098d447d492bb935c907f652f"
},
{
"groupid": "8",
"name": "Templates/Modules",
"uuid": "57b7ae836ca64446ba2c296389c009b7"
}
],
"id": 1
}CTemplateGroup::get() 在 ui/include/classes/api/services/CTemplateGroup.php 中。