Re: Project Introduction

Hi Markus

This issue only comes from our approach of implementing a ‘JSON API’ first
approach’, and then content negotiating HTML. We found that retro fitting a
JSON API onto a ‘HTML first approach’ was costly and created disparate
interfaces when interoperating. The ‘Hydra first approach’ solved this and
had the benefit enforcing hypermedia constraints into our application domain


The reason why postform is a separate resource is that when content
negotiation HTML, the ‘List create item’ is in a modal displayed on top of
the list.

You can see the screen shot here

https://github.com/drzoidb3rg/hydra/blob/master/ReviewListPostForm/UI%20modal%20create%20list%20item.PNG

So it s a hack I admit.

As you mention, I think we should have had the populated list with its POST
operation, then another link to the same list resource, but with a query
parameter of, something like, /reviewlist?empty=true, and a link relation
of ‘Item create form’

The link to the empty list will then obviously give us the correct List Id
for the POST operation.

Also

I would have though the most contentious issue from

https://github.com/drzoidb3rg/hydra/blob/master/ReviewListPostForm/ReviewListPostForm.json

would be the “made up” construct of

"range":"Data"

And then list embedded array of hydra classes, which represent the
available options for

"property":"reviewtype".

Did I miss a compliant way of doing this ? I find making the list of
options a separate resource onerous, having mechanism for defining this
‘inline’ as part of the POST is operation really convenient

Kind regards

Martin


On Sun, Dec 10, 2017 at 9:41 AM, Markus Lanthaler <markus.lanthaler@gmx.net>
wrote:

> On Wednesday, December 6, 2017 2:13 PM, Martin Bailey wrote:
> > I have authored a quick read me describing my experience of using Hydra.
> > I have included some actual code examples. These are available here :
> >
> > https://github.com/drzoidb3rg/hydra
>
> Cool, thanks for writing this up. You wrote
>
>     For lists, most of the time the POST operation is attached to the
> list. In
>     many cases it is required to model the postform as a separate
> hypermedia
>     resource. In this instance the list then has a link to the postform.
> Since the
>     Id of the postform is not the Id to actually perform a post to add an
> item,
>     we tend to add a Link to the list on the postform representation.
>
>     I guess a better solution would have beeen to model the Postform
>     representation as an empty list, which will include the associated POST
>     operation.
>
> Let me ask a few questions about this to make sure I fully understand
> this. Where do you want the client to send the HTTP POST request to? The
> following Hydra snippet says the POST should go to /reviewlistpostform
>
>   https://github.com/drzoidb3rg/hydra/blob/master/ReviewListPostForm/
> ReviewListPostForm.json
>
> The form HTML file in the same folder however shows a form which POSTs to
> /reviewlist
>
>   https://github.com/drzoidb3rg/hydra/blob/master/ReviewListPostForm/
> ReviewListPostForm.html
>
> Btw. why did you decide to split the form and the operation?
>
>
> Cheers,
> Markus
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
>
>
>

Received on Monday, 11 December 2017 10:41:01 UTC