hostinterface.massadd

Description

object hostinterface.massadd(object parameters)

This method allows to simultaneously add host interfaces to multiple hosts.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters containing the host interfaces to be created on the given hosts.

The method accepts the following parameters.

Parameter Type Description
interfaces object/array Host interfaces to create on the given hosts.

Parameter behavior:
- required
hosts object/array Hosts to be updated.

The hosts must have the hostid property defined.

Parameter behavior:
- required

Return values

(object) Returns an object containing the IDs of the created host interfaces under the interfaceids property.

Examples

Creating interfaces

Create an interface on two hosts.

Request:

{
           "jsonrpc": "2.0",
           "method": "hostinterface.massadd",
           "params": {
               "hosts": [
                   {
                       "hostid": "30050"
                   },
                   {
                       "hostid": "30052"
                   }
               ],
               "interfaces": {
                   "dns": "",
                   "ip": "127.0.0.1",
                   "main": 0,
                   "port": "10050",
                   "type": 1,
                   "useip": 1
               }
           },
           "id": 1
       }

Response:

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

See also

Source

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