Page 1 of 1

API wildcards

Posted: Wed Aug 19, 2020 1:02 pm
by BanditBBS
I put in a feature request in January 2016 for wildcards to work in the API urls. Was that ever completed and if so, their documentation on how ot use? I looked through the change log but didn't see it mentioned.

Re: API wildcards

Posted: Thu Aug 20, 2020 9:35 am
by scottwilkerson
By chance do you have a link to the request so we can see what you were looking for? I'm not fully clear on the request, it may be implemented, but not sure

Re: API wildcards

Posted: Thu Aug 20, 2020 9:42 am
by BanditBBS
https://support.nagios.com/forum/viewto ... 16&t=36648 <---original thread

Basically I want to do an API call for service status where the hostname is like abc* or abc%

Code: Select all

https://xxxx.xxx.com/nagiosxi/api/v1/objects/servicestatus?host_name=abc*&apikey=xxxxx&pretty=1"
The above being an example of what I'd like to do, get a service status list for all hosts that start with abc

Re: API wildcards

Posted: Thu Aug 20, 2020 10:09 am
by scottwilkerson
If you click "type" you can see all the options
api_options.JPG
So in your example you would do this

Code: Select all

https://xxxx.xxx.com/nagiosxi/api/v1/objects/servicestatus?host_name=lks:abc&apikey=xxxxx&pretty=1

Re: API wildcards

Posted: Thu Aug 20, 2020 10:10 am
by BanditBBS
Oh god, thanks you! I thought it was added before but just couldn't find it!

Close this up!

Re: API wildcards

Posted: Thu Aug 20, 2020 10:11 am
by scottwilkerson
The only caveat we could not achieve was if you wanted to wildcard like abc*123

This wasn't an option and would need to be filtered after the results are pulled.

Closing ticket