批量删除

描述

object hostinterface.massremove(object parameters)

该方法允许从给定的主机列表中批量删除主机接口

该方法适用于管理员超级管理员用户类型。可以在用户角色设置中撤销调用该方法的权限。有关详细信息,参阅用户角色

参数

(object) 参数包含更新的主机的ID和被删除的主机接口。

参数 类型 描述
hostids
(必选)
字符串/数组 被更新的主机ID
interfaces
(必选)
对象/数组 要删除的给定主机接口

主机接口对象必须定义ip, dns 和port属性。

返回值

(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"
        }
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

响应:

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

参考

来源

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