API inconsistency regarding puppetclasses

I was trying to list all the puppet classes in my server and when running:
curl -s -H "Accept:application/json" -k -u $USER:$PASS --get
https://$HOST/puppetclasses <https://%24host/puppetclasses>

I got one set of results.

and when running:
curl -s -H "Accept:application/json" -k -u $USER:$PASS --get
https://$HOST/api/puppetclasses <https://%24host/api/puppetclasses>

I got a different set of results.

Can someone please verify this.

Thanks,
Tal

Hello,

this is because API is using different approach than UI code.

In the UI we are using scoped_search for retrieval, but in API we are
using REST nested approach. From our documentation:

api :GET, "/puppetclasses/", "List all puppetclasses."
api :GET, "/hosts/:host_id/puppetclasses", "List all puppetclasses for host"
api :GET, "/hostgroups/:hostgroup_id/puppetclasses", "List all puppetclasses for hostgroup"
api :GET, "/environments/:environment_id/puppetclasses", "List all puppetclasses for environment"

Note our documentation on the site is currently little bit older, it
shows v1 API while we already have v2 API:

http://theforeman.org/api.html

I don't know if scoped_search by default filters out some puppetclasses
or not, anyway the API shows you all the records, currently you can
limit per host, hostgroup and environment. We will likely implement
scoped_search filtering also for our API, not sure when this is planned.
I expect something like:

GET /puppetclasses/?search=xyz

LZ

··· On Thu, Jul 11, 2013 at 07:50:12AM -0700, Tal K wrote: > I was trying to list all the puppet classes in my server and when running: > curl -s -H "Accept:application/json" -k -u $USER:$PASS --get > https://$HOST/puppetclasses > > I got one set of results. > > and when running: > curl -s -H "Accept:application/json" -k -u $USER:$PASS --get > https://$HOST/api/puppetclasses > > I got a different set of results. > > Can someone please verify this. > > Thanks, > Tal > > -- > 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 foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/groups/opt_out. > >


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

Lukas,

You're right, there is no currently scoped_search in puppetclasses_controller in the API. We can added it and still have nested routes such that it's like this

GET /hosts/:host_id/puppetclasses/?search=xyz

> Note our documentation on the site is currently little bit older, it
> shows v1 API while we already have v2 API:

v2 is still not released yet as it's still in development.

Joseph

··· ----- Original Message ----- From: "Lukas Zapletal" To: foreman-users@googlegroups.com Sent: Monday, July 15, 2013 11:43:33 AM Subject: Re: [foreman-users] API inconsistency regarding puppetclasses

Hello,

this is because API is using different approach than UI code.

In the UI we are using scoped_search for retrieval, but in API we are
using REST nested approach. From our documentation:

api :GET, “/puppetclasses/”, "List all puppetclasses."
api :GET, “/hosts/:host_id/puppetclasses”, "List all puppetclasses for host"
api :GET, “/hostgroups/:hostgroup_id/puppetclasses”, "List all puppetclasses for hostgroup"
api :GET, “/environments/:environment_id/puppetclasses”, “List all puppetclasses for environment”

Note our documentation on the site is currently little bit older, it
shows v1 API while we already have v2 API:

http://theforeman.org/api.html

I don’t know if scoped_search by default filters out some puppetclasses
or not, anyway the API shows you all the records, currently you can
limit per host, hostgroup and environment. We will likely implement
scoped_search filtering also for our API, not sure when this is planned.
I expect something like:

GET /puppetclasses/?search=xyz

LZ

On Thu, Jul 11, 2013 at 07:50:12AM -0700, Tal K wrote:

I was trying to list all the puppet classes in my server and when running:
curl -s -H “Accept:application/json” -k -u $USER:$PASS --get
https://$HOST/puppetclasses https://%24host/puppetclasses

I got one set of results.

and when running:
curl -s -H “Accept:application/json” -k -u $USER:$PASS --get
https://$HOST/api/puppetclasses https://%24host/api/puppetclasses

I got a different set of results.

Can someone please verify this.

Thanks,
Tal


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.

> v2 is still not released yet as it's still in development.

Ah which also explains why we publish v1 docs atm.

Cool.

LZ

··· On Mon, Jul 15, 2013 at 04:52:27AM -0400, Joseph Magen wrote:

Joseph

----- Original Message -----
From: “Lukas Zapletal” lzap@redhat.com
To: foreman-users@googlegroups.com
Sent: Monday, July 15, 2013 11:43:33 AM
Subject: Re: [foreman-users] API inconsistency regarding puppetclasses

Hello,

this is because API is using different approach than UI code.

In the UI we are using scoped_search for retrieval, but in API we are
using REST nested approach. From our documentation:

api :GET, “/puppetclasses/”, "List all puppetclasses."
api :GET, “/hosts/:host_id/puppetclasses”, "List all puppetclasses for host"
api :GET, “/hostgroups/:hostgroup_id/puppetclasses”, "List all puppetclasses for hostgroup"
api :GET, “/environments/:environment_id/puppetclasses”, “List all puppetclasses for environment”

Note our documentation on the site is currently little bit older, it
shows v1 API while we already have v2 API:

Foreman

I don’t know if scoped_search by default filters out some puppetclasses
or not, anyway the API shows you all the records, currently you can
limit per host, hostgroup and environment. We will likely implement
scoped_search filtering also for our API, not sure when this is planned.
I expect something like:

GET /puppetclasses/?search=xyz

LZ

On Thu, Jul 11, 2013 at 07:50:12AM -0700, Tal K wrote:

I was trying to list all the puppet classes in my server and when running:
curl -s -H “Accept:application/json” -k -u $USER:$PASS --get
https://$HOST/puppetclasses https://%24host/puppetclasses

I got one set of results.

and when running:
curl -s -H “Accept:application/json” -k -u $USER:$PASS --get
https://$HOST/api/puppetclasses https://%24host/api/puppetclasses

I got a different set of results.

Can someone please verify this.

Thanks,
Tal


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman

> Lukas,
>
> You're right, there is no currently scoped_search in
> puppetclasses_controller in the API. We can added it and still have nested
> routes such that it's like this
>
> GET /hosts/:host_id/puppetclasses/?search=xyz
>
> > Note our documentation on the site is currently little bit older, it
> > shows v1 API while we already have v2 API:
>
> v2 is still not released yet as it's still in development.
>
> just to clarify, v2 is usable and available in 1.2, but might change as
its considered 'in development'… saying that, v2. provides a few easier
usage path, so YMMV.

Ohad

··· On Mon, Jul 15, 2013 at 11:52 AM, Joseph Magen wrote:

Joseph

----- Original Message -----
From: “Lukas Zapletal” lzap@redhat.com
To: foreman-users@googlegroups.com
Sent: Monday, July 15, 2013 11:43:33 AM
Subject: Re: [foreman-users] API inconsistency regarding puppetclasses

Hello,

this is because API is using different approach than UI code.

In the UI we are using scoped_search for retrieval, but in API we are
using REST nested approach. From our documentation:

api :GET, “/puppetclasses/”, "List all puppetclasses."
api :GET, “/hosts/:host_id/puppetclasses”, "List all puppetclasses for
host"
api :GET, “/hostgroups/:hostgroup_id/puppetclasses”, "List all
puppetclasses for hostgroup"
api :GET, “/environments/:environment_id/puppetclasses”, “List all
puppetclasses for environment”

Note our documentation on the site is currently little bit older, it
shows v1 API while we already have v2 API:

Foreman

I don’t know if scoped_search by default filters out some puppetclasses
or not, anyway the API shows you all the records, currently you can
limit per host, hostgroup and environment. We will likely implement
scoped_search filtering also for our API, not sure when this is planned.
I expect something like:

GET /puppetclasses/?search=xyz

LZ

On Thu, Jul 11, 2013 at 07:50:12AM -0700, Tal K wrote:

I was trying to list all the puppet classes in my server and when
running:
curl -s -H “Accept:application/json” -k -u $USER:$PASS --get
https://$HOST/puppetclasses https://%24host/puppetclasses

I got one set of results.

and when running:
curl -s -H “Accept:application/json” -k -u $USER:$PASS --get
https://$HOST/api/puppetclasses https://%24host/api/puppetclasses

I got a different set of results.

Can someone please verify this.

Thanks,
Tal


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.


Later,

Lukas “lzap” Zapletal
irc: lzap #theforeman


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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
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 foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.