templategroup.get

描述

integer/array templategroup.get(object parameters)

该方法允许根据给定的参数检索模板组。

此方法适用于任何类型的用户。可以在用户角色设置中撤销调用此方法的权限。更多信息请参见 User roles

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

Parameter Type Description
graphids ID/array 仅返回包含指定图形的模板组。
groupids ID/array 仅返回具有给定模板组 ID 的模板组。
templateids ID/array 仅返回包含给定模板的模板组。
triggerids ID/array 仅返回包含具有给定触发器的模板的模板组。
with_graphs boolean 仅返回包含带有图形的模板的模板组。
with_graph_prototypes boolean 仅返回包含带有图形原型的模板的模板组。
with_httptests boolean 仅返回包含带有 web 检查的模板的模板组。
with_items boolean 仅返回包含带有监控项的模板的模板组。

覆盖 with_simple_graph_items 参数。
with_item_prototypes boolean 仅返回包含带有监控项原型的模板的模板组。

覆盖 with_simple_graph_item_prototypes 参数。
with_simple_graph_item_prototypes boolean 仅返回包含带有监控项原型的模板的模板组,这些监控项原型已启用创建且信息类型为数值。
with_simple_graph_items boolean 仅返回包含数值型监控项的模板的模板组。
with_templates boolean 仅返回包含模板的模板组。
with_triggers boolean 仅返回包含带有触发器的模板的模板组。
selectTemplates query 返回一个 templates 属性,其中包含属于该模板组的模板。

支持 count
limitSelects integer 限制子查询返回的记录数。

适用于以下子查询:
selectTemplates - 结果将按 template 排序。
sortfield string/array 按给定属性对结果排序。

可能的值:groupidname
countOutput boolean 这些参数在 参考说明 中有描述。
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) 返回以下之一:

  • array 的 objects;
  • 如果使用了 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 中。