Thanks for this. I couldn't find how to do a search anywhere in the API 
docs.

On Tuesday, 19 March 2013 03:20:21 UTC-4, Joseph Magen wrote:
>
> Try this using params[:search].  Foreman uses the scoped_search gem (
> github.com/wvanbergen/scoped_search).   
>
> Try it on the UI.  There is an auto-completer so it's easy to learn. 
>
> curl -u admin:secret -H "Accept:application/json" 
> http://0.0.0.0:3000/api/hosts?search='environment=production' 
>
> Joseph 
>
>
> ----- Original Message ----- 
> From: "Larry Fast" <[email protected] <javascript:>> 
> To: [email protected] <javascript:> 
> Sent: Tuesday, March 19, 2013 6:18:18 AM 
> Subject: [foreman-users] Re: Can I get a list of host<>environment through 
> the foreman API? 
>
>
>
>
>
> Why don't you search for an environment? e.g. 
> 1. ask for all envs 
> 2. ask for all hosts in each env 
> (should save you a lot of API calls). 
>
>
> OK, but I can't find an example of how to construct that. I'm guessing 
> that I would use the search API but I haven't seen any complete examples of 
> the syntax. Something like this I suppose: 
>
>
> curl -u admin:secret -H "Accept:application/json" http://0.0.0.0:3000/api/ 
> hosts?"hosts.environments.environments.name=foo" 
>
>
>
> And if I'm barking up the wrong tree, please point me to the right tree 
> :^) 
> Thanks, 
> Larry 
>
> -- 
> 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] <javascript:>. 
> To post to this group, send email to [email protected] 
> <javascript:>. 
> Visit this group at http://groups.google.com/group/foreman-users?hl=en . 
> For more options, visit https://groups.google.com/groups/opt_out . 
>
>

-- 
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