Page 1 of 1

Template API Endpoint

Posted: Wed Mar 17, 2021 4:24 pm
by J.A.K
Just wanted to check before I wrote something for it. Are there any POST options off the config API endpoint for host\service template creation? I'm not seeing anything in the API reference but wanted to validate real quick.

Re: Template API Endpoint

Posted: Thu Mar 18, 2021 1:22 pm
by dchurch
You could always try the raw config/import endpoint with a raw host template definition (a host template is a regular host definition with register 0):

Code: Select all

curl -X POST 'http://127.0.0.1/nagiosxi/api/v1/config/import?apikey=<MY API KEY>&pretty=1' -d '
define host {
    host_name           my_new_host_template
    use                 xiwizard_generic_host
    register            0
}'

Re: Template API Endpoint

Posted: Thu Mar 18, 2021 3:19 pm
by J.A.K
Oooh that's certainly an idea worth trying. I didn't think of that. Thank you!

Re: Template API Endpoint

Posted: Fri Mar 19, 2021 12:42 pm
by lmiltchev
@J.A.K, let us know if you have any further questions or if it is safe to close the topic. Thank you!

Re: Template API Endpoint

Posted: Fri Mar 19, 2021 12:48 pm
by J.A.K
I think I'm satisfied feel free to close it.