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.必须为每个主机原型定义“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”属性。

Return values 返回值

(object) Returns an object containing the IDs of the updated host prototypes under the hostids property.返回包含“hostid”属性下更新的主机原型的ID的对象。

Examples 示例

Disabling a host prototype禁用主机原型

Disable a host prototype, that is, set its status to 1.禁用主机原型,即将其状态设置为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 frontends/php/include/classes/api/services/CHostPrototype.php.