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.

ParameterTypeDescription
groupsobject/arrayTemplate groups to be updated.

The template groups must have the groupid property defined.

Parameter behavior:
- required
templatesobject/arrayTemplates to add to all template groups.

The templates must have 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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "templategroup.massadd",
  4. "params": {
  5. "groups": [
  6. {
  7. "groupid": "12"
  8. },
  9. {
  10. "groupid": "13"
  11. }
  12. ],
  13. "templates": [
  14. {
  15. "templateid": "10486"
  16. },
  17. {
  18. "templateid": "10487"
  19. }
  20. ]
  21. },
  22. "id": 1
  23. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "groupids": [
  5. "12",
  6. "13"
  7. ]
  8. },
  9. "id": 1
  10. }

See also

Source

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