Page 1 of 1

API: How to query for hosts via list of host names

Posted: Thu Feb 22, 2018 1:35 pm
by MrWoodward
Right now I'm using the end point:

Code: Select all

https://fqdn/nagiosxi/api/v1/objects/host?apikey=apikey&host_name=some_host_name
To get back detailed info about a host.

Is there a way to pass in a list of hostnames and get back a list of hosts?

Re: API: How to query for hosts via list of host names

Posted: Thu Feb 22, 2018 4:34 pm
by lmiltchev
Try:

Code: Select all

https://fqdn/nagiosxi/api/v1/objects/host?apikey=apikey&host_name=in:host1,host2,host3,hostx

Re: API: How to query for hosts via list of host names

Posted: Fri Feb 23, 2018 4:11 pm
by MrWoodward
That's most excellent. I'll try this now.

Re: API: How to query for hosts via list of host names

Posted: Fri Feb 23, 2018 4:16 pm
by lmiltchev
Let us know if it worked for you. Thanks!

Re: API: How to query for hosts via list of host names

Posted: Fri Feb 23, 2018 4:45 pm
by MrWoodward
Totally worked. Also worked for other endpoints as well.

Made my code much much faster. Thanks!

Re: API: How to query for hosts via list of host names

Posted: Fri Feb 23, 2018 4:52 pm
by lmiltchev
I am glad I could help! :)

I will be locking this topic. If you have any more questions/issues, please start a new thread. Thank you!