Sidebar

api:hostgroup:massadd

Table of Contents

massAdd()

Available since version: 1.8

Parameters

Multidimensional array with Host groups data

ParameterTypeOptionalDescriptionDetails
groupsarray Host group to update.
hostsarray Yes Host objects that should be added to host groups.
templatesarray Yes Template objects that should be added to host groups.

Returns

ParameterDescription
resultOperation successful. Result will contain array of updated Host group IDs.
errorIn case of any errors

Example

Add two hosts with ID “100100000010092”, “100100000010086” to two host groups with ID “100100000000042”, “100100000000013”

{
"jsonrpc":"2.0",
"method":"hostgroup.massAdd",
"params":{ 
	"groups": [
	  {"groupid": "100100000000042"},
	  {"groupid": "100100000000013"}
	],
	"hosts": [ 
		{"hostid": "100100000010092"},
		{"hostid": "100100000010086"}
	]
},
"auth":"f223adf833b2bf2ff38574a67bba6372",
"id":2
}
Host groups updated successfully:

{
"jsonrpc":"2.0",
"result":{
	"groupids":["100100000000042","100100000000013"]
},
"id":2
}