object hostinterface.create(object/array hostInterfaces)
该方法允许创建新的主机接口。
该方法适用于管理员和超级管理员用户类型。可以在用户角色设置中撤销调用该方法的权限。有关详细信息,参阅用户角色。
(object/array) 创建主机接口,该方法接受主机接口的标准主机接口属性。
(object) 在 interfaceids 属性中返回已创建主机接口ID对象。 返回的ID顺序与传入的主机接口顺序保持一致。
给ID为30052主机创建辅助IP代理接口
请求:
{ "jsonrpc": "2.0", "method": "hostinterface.create", "params": { "hostid": "30052", "main": "0", "type": "1", "useip": "1" "ip": "127.0.0.1", "dns": "", "port": "10050", }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }响应:
请求:
{ "jsonrpc": "2.0", "method": "hostinterface.create", "params": { "hostid": "10456", "main": "0", "type": "2", "useip": "1", "ip": "127.0.0.1", "dns": "", "port": "1601", "details": { "version": "2", "bulk": "1", "community": "{$SNMP_COMMUNITY}" } }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }响应:
CHostInterface::create() in ui/include/classes/api/services/CHostInterface.php。