获取

描述

integer/array templategroup.get(object parameters)

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

任何类型的用户都可以使用此方法。可以在用户角色设置中撤销调用该方法的权限. 更多信息请查看用户角色.

参数

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

该方法支持以下参数.

参数类型描述
graphidsID/array仅返回包含给定图形模板的模板组.
groupidsID/array仅返回具有给定模板组ID的模板组.
templateidsID/array仅返回包含给定模板的模板组.
triggeridsID/array仅返回包含给定触发器的模板的模板组.
with_graphsflag仅返回包含图形的模板的模板组.
with_graph_prototypesflag仅返回包含图形原型的模板的模板组.
with_httptestsflag仅返回包含网页测试的模板的模板组.
with_itemsflag仅返回包含监控项的模板的模板组.

覆盖 with_simple_graph_items 参数.
with_item_prototypesflag仅返回包含监控项原型的模板的模板组.

覆盖 with_simple_graph_item_prototypes 参数.
with_simple_graph_item_prototypesflag仅返回包含启用了创建功能且具有数值类型信息的监控项原型的模板的模板组.
with_simple_graph_itemsflag仅返回包含数值类型监控项的模板的模板组.
with_templatesflag仅返回包含有模板的模板组.
with_triggersflag仅返回包含触发器的模板的模板组.
selectTemplatesquery返回此模板组中的模板templates 的属性.

支持 count.
limitSelectsinteger限制子选择返回的记录数.

适用于以下子选项:
selectTemplates - 结果按照template排序.
sortfieldstring/array根据给定的属性进行排序.

可能的值: groupid, name.
countOutputboolean这些参数对于所有get方法都是通用的,在参考注释 中有详细描述.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

返回值

(integer/array) 返回两者其一:

  • 一个对象数组;
  • 如果使用了’countOutput’参数,则对检索对象进行计数。

示例

按照名字检索模板组

检索名为 “Templates/Databases”和 “Templates/Modules”的两个模板组的数据.

请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "templategroup.get",
  4. "params": {
  5. "output": "extend",
  6. "filter": {
  7. "name": [
  8. "Templates/Databases",
  9. "Templates/Modules"
  10. ]
  11. }
  12. },
  13. "id": 1
  14. }

响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "groupid": "13",
  6. "name": "Templates/Databases",
  7. "uuid": "748ad4d098d447d492bb935c907f652f"
  8. },
  9. {
  10. "groupid": "8",
  11. "name": "Templates/Modules",
  12. "uuid": "57b7ae836ca64446ba2c296389c009b7"
  13. }
  14. ],
  15. "id": 1
  16. }

参阅

来源

CTemplateGroup::get() in ui/include/classes/api/services/CTemplateGroup.php.