templategroup.get
Description
integer/array templategroup.get(object parameters)
The method allows to retrieve template groups according to the given parameters.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object)
Parameters defining the desired output.
The method supports the following parameters.
Parameter | Type | Description |
---|---|---|
graphids | string/array | Return only template groups that contain templates with the given graphs. |
groupids | string/array | Return only template groups with the given template group IDs. |
templateids | string/array | Return only template groups that contain the given templates. |
triggerids | string/array | Return only template groups that contain templates with the given triggers. |
with_graphs | flag | Return only template groups that contain templates with graphs. |
with_graph_prototypes | flag | Return only template groups that contain templates with graph prototypes. |
with_httptests | flag | Return only template groups that contain templates with web checks. |
with_items | flag | Return only template groups that contain templates with items. Overrides the with_simple_graph_items parameters. |
with_item_prototypes | flag | Return only template groups that contain templates with item prototypes. Overrides the with_simple_graph_item_prototypes parameter. |
with_simple_graph_item_prototypes | flag | Return only template groups that contain templates with item prototypes, which are enabled for creation and have numeric type of information. |
with_simple_graph_items | flag | Return only template groups that contain templates with numeric items. |
with_templates | flag | Return only template groups that contain templates. |
with_triggers | flag | Return only template groups that contain templates with triggers. |
selectTemplates | query | Return a templates property with the templates that belong to the template group. Supports count . |
limitSelects | integer | Limits the number of records returned by subselects. Applies to the following subselects: selectTemplates - results will be sorted by template . |
sortfield | string/array | Sort the result by the given properties. Possible values are: groupid , name . |
countOutput | boolean | These parameters being common for all get methods are described in detail in the reference commentary page. |
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’参数,则对检索对象进行计数。
示例
Retrieving data by name
Retrieve all data about two template groups named “Templates/Databases” and “Templates/Modules”.
Request:
{
"jsonrpc": "2.0",
"method": "templategroup.get",
"params": {
"output": "extend",
"filter": {
"name": [
"Templates/Databases",
"Templates/Modules"
]
}
},
"auth": "6f38cddc44cfbb6c1bd186f9a220b5a0",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"groupid": "13",
"name": "Templates/Databases",
"uuid": "748ad4d098d447d492bb935c907f652f"
},
{
"groupid": "8",
"name": "Templates/Modules",
"uuid": "57b7ae836ca64446ba2c296389c009b7"
}
],
"id": 1
}
See also
Source
CTemplateGroup::get() in ui/include/classes/api/services/CTemplateGroup.php.