hostprototype.update

Description

object hostprototype.update(object/array **hostPrototypes**)

This method allows to update existing host prototypes.

Parameters

(object/array) Host prototype properties to be updated.

The hostid property must be defined for each host prototype, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

Additionally to the standard host prototype properties, the method accepts the following parameters.

ParameterTypeDescription
groupLinksarrayGroup links to replace the current group links on the host prototype.
groupPrototypesarrayGroup prototypes to replace the existing group prototypes on the host prototype.
macrosobject/arrayUser macros to replace the current user macros.

All macros that are not listed in the request will be removed.
templatesobject/arrayTemplates to replace the currently linked templates.

The templates must have the templateid property defined.

Return values

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

Examples

Disabling a host prototype

Disable a host prototype, that is, set its status to 1.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "hostprototype.update",
  4. "params": {
  5. "hostid": "10092",
  6. "status": 1
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

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

See also

Source

CHostPrototype::update() in ui/include/classes/api/services/CHostPrototype.php.