创建

描述

object hostinterface.create(object/array hostInterfaces)

该方法允许创建新的主机接口.

参数

(对象/数组) 创建主机接口,该方法接受标准主机接口属性的主机接口.

返回值

(对象)interfaceids属性中返回已创建主机接口ID的对象.返回的ID顺序与传入的主机接口顺序保持一致.

示例

创建主机接口

给ID为30052主机创建辅助IP代理接口

请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "hostinterface.create",
  4. "params": {
  5. "hostid": "30052",
  6. "dns": "",
  7. "ip": "127.0.0.1",
  8. "main": 0,
  9. "port": "10050",
  10. "type": 1,
  11. "useip": 1
  12. },
  13. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  14. "id": 1
  15. }

响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "interfaceids": [
  5. "30062"
  6. ]
  7. },
  8. "id": 1
  9. }

参考

来源

CHostInterface::create() in frontends/php/include/classes/api/services/CHostInterface.php.

Source

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