Hi,
We use XI 5.2.2
My question relates to this post. Using REST API to update host's description....
https://support.nagios.com/forum/viewto ... 16&t=38469
Question: When I use the REST API POST... this call requires check/alert settings and values in the call. When the call completes it inserts these check and alert settings into the updated host. The issue for us is that we use templates exclusively to set each host's check/alert settings. Is there a way to use the POST call without having to pass in these settings?
As always thank you.
brdr
REST API - POST - Make use of templates
Re: REST API - POST - Make use of templates
You should be able to do so by appending &force=1 (which will skip validation checks). See the example below as an example -
Keep in mind if you do not inherit everything, there isn't any validation check running to make sure your template is proper so you could encounter more errors if it isn't setup properly.
Code: Select all
[root@localhost libexec]# curl -XPOST "http://192.168.4.179/nagiosxi/api/v1/config/host?apikey=uui5lt5s&pretty=1" -d "host_name=testtemplate&address=128.0.0.1&use=linux-server" {
"error": "Missing required variables",
"missing": [
"max_check_attempts",
"check_period",
"notification_interval",
"notification_period",
"contacts OR contact_groups"
]
}
[root@localhost libexec]# curl -XPOST "http://192.168.4.179/nagiosxi/api/v1/config/host?apikey=uui5lt5s&pretty=1" -d "host_name=testtemplate&address=128.0.0.1&use=linux-server&force=1"
{
"success": "Successfully added testtemplate to the system. Config imported but not yet applied."
}
Former Nagios Employee