manual:api:reference:host:update

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:api:reference:host:update [2019/08/09 12:53]
talbergs reverted adding "inventory_mode" field to parameters
manual:api:reference:host:update [2020/08/05 06:22] (current)
martins-v internal link to data types (ZBX-17160)
Line 12: Line 12:
  
 The ''​hostid''​ property must be defined for each host, all other properties are optional. Only the given properties will be updated, all others will remain unchanged. The ''​hostid''​ property must be defined for each host, all other properties are optional. Only the given properties will be updated, all others will remain unchanged.
 +
 +Note, however, that updating the host technical name will also update the host's visible name (if not given or empty) by the host's technical name value.
  
 Additionally to the [[object#​host|standard host properties]],​ the method accepts the following parameters. Additionally to the [[object#​host|standard host properties]],​ the method accepts the following parameters.
  
-^ Parameter ^ Type ^ Description ^ +^ Parameter ^ [[:​manual/​api/​reference_commentary#​data_types|Type]] ^ Description ^ 
-| groups | object/​array | Host groups to replace the current host groups the host belongs to.\\ \\ The host groups must have the ''​groupid''​ property defined. All host groups that are not listed in the request will be unlinked. | +| groups | object/​array | Host [[:​manual/​api/​reference/​hostgroup/​object#​host_group|groups]] to replace the current host groups the host belongs to.\\ \\ The host groups must have the ''​groupid''​ property defined. All host groups that are not listed in the request will be unlinked. | 
-| interfaces | object/​array | Host interfaces to replace the current host interfaces.\\ \\ All interfaces that are not listed in the request will be removed. ​ | +| interfaces | object/​array | Host [[:​manual/​api/​reference/​hostinterface/​object| ​interfaces]] to replace the current host interfaces.\\ \\ All interfaces that are not listed in the request will be removed. ​ | 
-| tags | object/​array | Host tags to replace the current host tags.\\ \\ All tags that are not listed in the request will be removed. | +| tags | object/​array |Host [[:​manual/​api/​reference/​host/​object#​host_tag|tags]] to replace the current host tags.\\ \\ All tags that are not listed in the request will be removed. | 
-| inventory | object | Host inventory properties. | +| inventory | object | Host [[:​manual/​api/​reference/​host/​object#​host_inventory|inventory]] properties. | 
-| macros | object/​array | User macros to replace the current user macros.\\ \\ All macros that are not listed in the request will be removed. | +| macros | object/​array ​| [[:​manual/​api/​reference/​usermacro/​object|User macros]] to replace the current user macros.\\ \\ All macros that are not listed in the request will be removed. | 
-| templates | object/​array | Templates to replace the currently linked templates. All templates that are not listed in the request will be only unlinked. \\ \\ The templates must have the ''​templateid''​ property defined. | +| templates | object/​array ​| [[: manual/​api/​reference/​template/​object|Templates]] to replace the currently linked templates. All templates that are not listed in the request will be only unlinked. \\ \\ The templates must have the ''​templateid''​ property defined. | 
-| templates_clear | object/​array | Templates to unlink and clear from the host. \\ \\ The templates must have the ''​templateid''​ property defined. |+| templates_clear | object/​array ​| [[: manual/​api/​reference/​template/​object|Templates]] to unlink and clear from the host. \\ \\ The templates must have the ''​templateid''​ property defined. |
  
 <note tip>As opposed to the Zabbix frontend, when ''​name''​ (visible host name) is the same as ''​host''​ (technical host name), updating ''​host''​ via API will not automatically update ''​name''​. Both properties need to be updated explicitly.</​note>​ <note tip>As opposed to the Zabbix frontend, when ''​name''​ (visible host name) is the same as ''​host''​ (technical host name), updating ''​host''​ via API will not automatically update ''​name''​. Both properties need to be updated explicitly.</​note>​
Line 118: Line 120:
             {             {
                 "​macro":​ "​{$DISC}",​                 "​macro":​ "​{$DISC}",​
-                "​value":​ "​sda"​+                "​value":​ "sda", 
 +                "​description":​ "​Updated description"
             }             }
         ]         ]
Line 222: Line 225:
 ==== Source ==== ==== Source ====
  
-CHost::​update() in //frontends/​php/​include/​classes/​api/​services/​CHost.php//​.+CHost::​update() in //ui/​include/​classes/​api/​services/​CHost.php//​.