批量删除

描述

object hostinterface.massremove(object parameters)

该方法允许从给定主机中删除主机接口。

此方法仅适用于 AdminSuper admin 用户类型。调用该方法的权限可在用户角色设置中撤销。更多信息请参阅 用户角色

参数

(object) 参数,其中包含要更新的主机 ID 和要删除的接口。

参数 类型 说明
interfaces object/array 要从给定的主机删除的 主机接口

主机接口对象必须只定义ipdnsport属性。

参数行为:
- 必须
hostids ID/array 要更新的主机 ID。

参数行为:
- 必须

返回值

(object) 返回一个对象,其中在 interfaceids 属性下包含已删除主机接口的 ID。

示例

删除接口

从两台主机上删除 "127.0.0.1" SNMP 接口。

请求

{
    "jsonrpc": "2.0",
    "method": "hostinterface.massremove",
    "params": {
        "hostids": [
            "30050",
            "30052"
        ],
        "interfaces": {
            "dns": "",
            "ip": "127.0.0.1",
            "port": "161"
        }
    },
    "id": 1
}

响应:

{
    "jsonrpc": "2.0",
    "result": {
        "interfaceids": [
            "30069",
            "30070"
        ]
    },
    "id": 1
}

另见

来源

CHostInterface::massRemove() 在 ui/include/classes/api/services/CHostInterface.php