Icinga2 API curl call


I’ve a quick question about API / curl call

with this curl:

curl -k -s -u admin:BLABLABLA -H 'X-HTTP-Method-Override: GET' -X POST '' -d '{ "filter": "host.vars.rack == \"A01\"", "pretty": true }'

I can retrieve all my hosts which are located on rack A01 (rack is a field I’ve setted on my icinga confguration).

I want to do the same curl but with host.vars.rack like A0* (to retrieve all hosts with rack like A0*) but it doesnt work. Itried with host.vars.rack >= \A01\ but then, No objects found.

If I use icingaweb it works with:


Do you have any idea how I can do with my curl call to do the same please?


1 Like

I would check out advanced filters in the docs.

I’ve already checked this page with no success.

Can’t fix that then; using the above link I’m able to obtain exactly what you want to do (using a different custom var of course)

So if you use a similar curl like:

curl -k -s -u admin:BLABLABLA -H 'X-HTTP-Method-Override: GET' -X POST '' -d '{ "filter": "host.vars.rack >= \"A0*\"", "pretty": true }'

it works?

“>=” instead of “==”
A0* instead of A01

If you have an example when it works on your side perhaps please?

succedeed with:

curl -k -s -u admin:WWWWW -H 'X-HTTP-Method-Override: GET' -X POST '' -d '{ "filter": "match(\"A*\", host.vars.rack)", "pretty": true }'   
1 Like