object hostprototype.update(object/array hostPrototypes)
This method allows to update existing host prototypes.此方法允许更新现有的主机原型。
(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.必须为每个主机原型定义“hostid”属性,所有其他属性都是可选的。 只有过期的属性将被更新,所有其他属性将保持不变。
Additionally to the standard host prototype properties, the method accepts the following parameters.除标准主机原型属性外,该方法还接受以下参数。
参数 类 | 描述 | |
---|---|---|
groupLinks | array | Group links to replace the current group links on the host prototype.替换主机原型上当前组链接的组链接 |
groupPrototypes | array | Group prototypes to replace the existing group prototypes on the host prototype. 代替主机原型上现有组原型的组原型。 |
inventory | object | Host prototype inventory properties.主机原型库存属性。 |
templates | object/array | Templates to replace the currently linked templates.用于替换当前链接的模板的模板。 The templates must have the templateid property defined.模板必须定义“templateid”属性。 |
(object)
Returns an object containing the IDs of the updated host prototypes under the hostids
property.返回包含“hostid”属性下更新的主机原型的ID的对象。
Disable a host prototype, that is, set its status to 1.禁用主机原型,即将其状态设置为1。
Request:
{
"jsonrpc": "2.0",
"method": "hostprototype.update",
"params": {
"hostid": "10092",
"status": 1
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
CHostPrototype::update() in frontends/php/include/classes/api/services/CHostPrototype.php.