host.massremove

Description

object host.massremove(object **parameters**)

This method allows to remove related objects from multiple hosts.

Parameters

(object) Parameters containing the IDs of the hosts to update and the objects that should be removed.

ParameterTypeDescription
hostids
(required)
string/arrayIDs of the hosts to be updated.
groupidsstring/arrayHost groups to remove the given hosts from.
interfacesobject/arrayHost interfaces to remove from the given hosts.

The host interface object must have the ip, dns and port properties defined.
macrosstring/arrayUser macros to delete from the given hosts.
templateidsstring/arrayTemplates to unlink from the given hosts.
templateids_clearstring/arrayTemplates to unlink and clear from the given hosts.

Return values

(object) Returns an object containing the IDs of the updated hosts under the hostids property.

Examples

Unlinking templates

Unlink a template from two hosts and delete all of the templated entities.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "host.massremove",
  4. "params": {
  5. "hostids": ["69665", "69666"],
  6. "templateids_clear": "325"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "hostids": [
  5. "69665",
  6. "69666"
  7. ]
  8. },
  9. "id": 1
  10. }

See also

Source

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