The search parameter can be used also in the api: https://theforeman.org/api/1.15/index.html
The request will be something like: https://foreman.mydomain.com/api/v2/hosts?search="hostgroup_id=1" T. On Wed, Aug 16, 2017 at 1:05 PM, Roy Burstein <[email protected]> wrote: > Hi Thomas , > > Thanks for your response , any workaround for the rest api interface? > > Thanks , > Roy > > On Wednesday, August 16, 2017 at 11:10:25 AM UTC+3, Tomas Strachota wrote: >> >> Hello, >> this is a known bug: >> http://projects.theforeman.org/issues/20204 >> >> As a workaround you can use the search parameter to filter hosts by >> hostgroups: >> "hostgroup = <HG_NAME>" or "hostgroup_id = <HG_ID>" >> >> T. >> >> >> On Tue, Aug 15, 2017 at 5:24 PM, roy.b via foreman-dev >> <[email protected]> wrote: >> > Hi all , >> > >> > I am new here and hope it's OK to submit issues . >> > I have created new Hostgroup in foreman and the group is empty . >> > >> > Querying the hosts table in foreman schema : >> > >> > mysql> select id from hostgroups h >> > -> where h.name='myhostgroup'; >> > +-----+ >> > | id | >> > +-----+ >> > | 243 | >> > +-----+ >> > 1 row in set (0.00 sec) >> > >> > mysql> select * from hosts where hostgroup_id=243; >> > Empty set (0.00 sec) >> > >> > >> > >> > when trying to do the same with the API : >> > >> > https://foreman.mydomain.com/api/v2/hostgroups/243/hosts >> > >> > -- I got as result all the servers in foreman . >> > >> > Am I doing something wrong ? or is it a bug ? >> > >> > >> > Thanks , >> > Roy >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "foreman-dev" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "foreman-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
