This method allows to create new hosts.此方法允许创建新的主机。

    Parameters 参数

    (object/array) Hosts to create.要创建的主机。

    Additionally to the standard host properties, the method accepts the following parameters.另外,对于标准主机属性,此方法接受以下参数。

    Examples范例

    Creating a host 创建一个主机

    Create a host called “Linux server” with an IP interface, add it to a group, link a template to it and set the MAC addresses in the host inventory.创建一个具有IP接口的“Linux Server”主机,将其添加到主机组中,链接一个模板并且把MAC地址设置到主机资产清单里。

    Request:

    Response:

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

    Source 来源

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