You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

templategroup.massadd

Description

object templategroup.massadd(object parameters)

This method allows to simultaneously add multiple related objects to all the given template groups.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters containing the IDs of the template groups to update and the objects to add to all the template groups.

The method accepts the following parameters.

Parameter Type Description
groups object/array Template groups to be updated.

The template groups must have only the groupid property defined.

Parameter behavior:
- required
templates object/array Templates to add to all template groups.

The templates must have only the templateid property defined.

Parameter behavior:
- required

Return values

(object) Returns an object containing the IDs of the updated template groups under the groupids property.

Examples

Adding templates to template groups

Add two templates to template groups with IDs 12 and 13.

Request:

{
           "jsonrpc": "2.0",
           "method": "templategroup.massadd",
           "params": {
               "groups": [
                   {
                       "groupid": "12"
                   },
                   {
                       "groupid": "13"
                   }
               ],
               "templates": [
                   {
                       "templateid": "10486"
                   },
                   {
                       "templateid": "10487"
                   }
               ]
           },
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "groupids": [
                   "12",
                   "13"
               ]
           },
           "id": 1
       }

See also

Source

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