[Hawkular-dev] REST ideas
Viliam Rockai
vrockai at redhat.com
Wed Feb 11 09:49:10 EST 2015
On Wed, 2015-02-11 at 09:08 -0500, Lukas Krejci wrote:
>
> ----- Original Message -----
> > From: "Heiko W.Rupp" <hrupp at redhat.com>
> > To: hawkular-dev at lists.jboss.org
> > Sent: Wednesday, 11 February, 2015 2:43:00 PM
> > Subject: Re: [Hawkular-dev] REST ideas
> >
> >
> > > Am 11.02.2015 um 14:23 schrieb Viliam Rockai <vrockai at redhat.com>:
> > >
> > > Hi,
> > >
> > > I'm looking at hawkular-inventory and I've got several comments (liveoak
> > > legacy) which could apply on other rest endpoints, too:
> > >
> > > 1. I think it would be easier to use/get if we make it more
> > > hierarchical. That means; instead of using two distinct URLs (resources
> > > vs. resource) for lists (/hawkular/inventory/rest-test/resources/) and
> > > entities (/hawkular/inventory/rest-test/resource/x1422733176502), we use
> > > only one (/hawkular/inventory/rest-test/resources/x1422733176502).
> >
> > This is a good question/suggestion. I tried to follow the pattern of <foo>S
> > for list + creation
> > and <foo>/x for identifying individual objects - sort of like in natural
> > language.
> >
> >
> >
> > > 2. Sometimes, in the docs, attribute called "name" is used, and referred
> > > to, as an "id". Would it be possible and make sense to choose just one
> > > notation and use it in the representation?
> >
> > Yes. I think we may need some more overall cleanup as soon as we know
> > more about some terms and semantics we want to use.
> > >
> > > 3. Usage of methods: When you want to create a metric, you use the PUT
> > > method. What about unifying methods in some commonly used manner. Like
> > > post for create, put for edit?
> >
>
> Well, I am actually not so sure here.
>
> For some entities, like tenants themselves or environments, I think
> the URL pattern for creation could look like:
>
> /tenants/{tenantId}
>
> or
>
> /{tenantId}/environments/{environmentId}
>
> These guys are a little bit different because the USER supplies the ID.
>
> so we could have a POST like
>
> /tenants/?tenantId=asdf
>
> or an empty POST or PUT into
>
> /tentants/{tenantId}
>
> both tenant or environment are essentially non-updateable.
>
> I am no REST expert but an "empty POST" seems weird to me as does specifying
> the ID as an parameter in POST request. It is just my personal taste, but I
> find the PUT for creation here the most natural.
I'm not sure I get it. What's wrong with a POST on /tenants with data
like {id: 'myNewId'}?
>
> I am easily swayed though ;)
>
> > I guess you are right here. I used put instead of post for the metrics, as
> > they are
> > sort of dependent objects.
> >
> >
> >
> > Heiko
> >
> >
> > _______________________________________________
> > hawkular-dev mailing list
> > hawkular-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hawkular-dev
> >
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev
More information about the hawkular-dev
mailing list