Thanks Dominic,

This search option is a proper approach to get active hosts rather than 
"configuration_status_label=Active".

But adding to Vishal's query, our requirement is to list the active hosts 
along with their facts values (like, hostname, macaddress, manufacturer, 
etc.) using a single api.

API we are using to list all hosts and their facts values is: 
"/api/fact_values"

We can add an external facts value to this api which will provide us 
last_report > "35 minutes ago" .
But, we are not sure how to get this value.

Thanks,
Amrit


On Thursday, October 13, 2016 at 1:23:10 PM UTC+5:30, Dominic Cleal wrote:
>
> On 12/10/16 18:27, Vishal Sarin wrote: 
> > I want an API query which returns hosts with 
> > "configuration_status_label=Active" 
> > 
> > I am aware of the these APIs but not sure how can I add that query. 
> > 
> > Can someone please help me here? 
> > 
> > APIs I know of 
> > 
> > "hosts": { 
> >       "List all hosts": "/api/hosts", 
>
> Use this API to list all hosts, but pass a search into it. The "active" 
> hosts are those with a certain search query, which you'll find if you 
> follow the active links from the Dashboard or look at your bookmarks 
> (under Administer). 
>
> e.g. GET 
> /api/v2/hosts?search=last_report%20%3E%20%2235%20minutes%20ago%22%20and%20(status.applied%20%3E%200%20or%20status.restarted%20%3E%200)%09
>  
>
>
> (URL-encoded version of last_report > "35 minutes ago" and 
> (status.applied > 0 or status.restarted > 0)) 
>
> -- 
> Dominic Cleal 
> [email protected] <javascript:> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to