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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

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

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

Try:

Code: Select all

https://fqdn/nagiosxi/api/v1/objects/host?apikey=apikey&host_name=in:host1,host2,host3,hostx
Be sure to check out our Knowledgebase for helpful articles and solutions!
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

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

Post by MrWoodward »

That's most excellent. I'll try this now.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

Let us know if it worked for you. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
MrWoodward
Posts: 66
Joined: Fri Jan 06, 2017 1:58 pm

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

Post by MrWoodward »

Totally worked. Also worked for other endpoints as well.

Made my code much much faster. Thanks!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked