template.massremove

Description

object template.massremove(object parameters)

This method allows to remove related objects from multiple templates.

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 templates to update and the objects that should be removed.

ParameterTypeDescription
templateidsstring/arrayIDs of the templates to be updated.

Parameter behavior:
- required
groupidsstring/arrayTemplate groups from which to remove the given templates.
macrosstring/arrayUser macros to delete from the given templates.
templateids_clearstring/arrayTemplates to unlink and clear from the given templates (upstream).
templateids_linkstring/arrayTemplates to unlink from the given templates (upstream).

Return values

(object) Returns an object containing the IDs of the updated templates under the templateids property.

Examples

Removing templates from a group

Remove two templates from group “2”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "template.massremove",
  4. "params": {
  5. "templateids": [
  6. "10085",
  7. "10086"
  8. ],
  9. "groupids": "2"
  10. },
  11. "id": 1
  12. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "templateids": [
  5. "10085",
  6. "10086"
  7. ]
  8. },
  9. "id": 1
  10. }

Unlinking templates from a host

Unlink templates “10106” and “10104” from template “10085”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "template.massremove",
  4. "params": {
  5. "templateids": "10085",
  6. "templateids_link": [
  7. "10106",
  8. "10104"
  9. ]
  10. },
  11. "id": 1
  12. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "templateids": [
  5. "10085"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

Source

CTemplate::massRemove() in ui/include/classes/api/services/CTemplate.php.