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.

ParameterTypeDescription
graphidsstring/arrayReturn only template groups that contain templates with the given graphs.
groupidsstring/arrayReturn only template groups with the given template group IDs.
templateidsstring/arrayReturn only template groups that contain the given templates.
triggeridsstring/arrayReturn only template groups that contain templates with the given triggers.
with_graphsflagReturn only template groups that contain templates with graphs.
with_graph_prototypesflagReturn only template groups that contain templates with graph prototypes.
with_httptestsflagReturn only template groups that contain templates with web checks.
with_itemsflagReturn only template groups that contain templates with items.

Overrides the with_simple_graph_items parameters.
with_item_prototypesflagReturn only template groups that contain templates with item prototypes.

Overrides the with_simple_graph_item_prototypes parameter.
with_simple_graph_item_prototypesflagReturn only template groups that contain templates with item prototypes, which are enabled for creation and have numeric type of information.
with_simple_graph_itemsflagReturn only template groups that contain templates with numeric items.
with_templatesflagReturn only template groups that contain templates.
with_triggersflagReturn only template groups that contain templates with triggers.
selectTemplatesqueryReturn a templates property with the templates that belong to the template group.

Supports count.
limitSelectsintegerLimits the number of records returned by subselects.

Applies to the following subselects:
selectTemplates - results will be sorted by template.
sortfieldstring/arraySort the result by the given properties.

Possible values: groupid, name.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary page.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving data by name

Retrieve all data about two template groups named “Templates/Databases” and “Templates/Modules”.

Request:

  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. }

Response:

  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. }

See also

Source

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