Ad Widget

Collapse

API How to filter hosts on hostgroups?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xzenor
    Junior Member
    • Aug 2022
    • 2

    #1

    API How to filter hosts on hostgroups?

    Hi everyone,

    I'm trying to get the hosts from a hostgroup with the api. I've been looking at host.get and if you scroll down to the examples in the documentation then the second example should give me the groups but it doesn't.
    I used that exact example without the filter even but no groups are shown. All the other information of the host is shown perfectly in json but the "groups" part is completely missing.

    Then there's also hostgroup.get where selectHosts should give me the hosts in the group if I understand it correctly but that doesn't work either. I might be using that incorrectly though. Here's the params part I send:
    Code:
    "params":
    {
        "output": ["name", "id"],
        "selectHosts": "extend",
    },
    Can anyone give me a few pointers on what I might be doing wrong?
Working...