Это перевод страницы документации с английского языка. Помогите нам сделать его лучше.

templategroup.get

Описание

integer/array templategroup.get(параметры объекта)

Метод позволяет получить группы шаблонов в соответствии с заданными параметрами.

Этот метод доступен пользователям любого типа. Разрешения на вызов метода можно отозвать в настройках ролей пользователя. Дополнительную информацию см. в разделе Роли пользователей.

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

Возвращаемые значения

(целое число/массив) Возвращает либо:

  • · массив объектов;
  • · количество извлеченных объектов, если использовался параметр 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

Источник

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