Page 1 of 1

Adding Existing Hosts to Existing Host Groups

Posted: Thu Jun 27, 2019 12:13 pm
by mananatmacys
How can I use the API to add existing hosts to existing host groups?

Re: Adding Existing Hosts to Existing Host Groups

Posted: Thu Jun 27, 2019 3:26 pm
by benjaminsmith
Hello,

Modifying the hostgroup using the REST API will re-write the members list. For example, to add host1 and host2 to the test-group, the command would be as follows:

Code: Select all

curl -XPUT "http://<ip-address>/nagiosxi/api/v1/config/hostgroup/test-group?apikey=<your api key>&pretty=1&members=host1,host2&applyconfig=1"
You'll find sample commands for your server in Help > API Docs > Config Reference.

Let me know if you have any questions.