Re: hello and some feedback

Hi there,

On Tue, Aug 19, 2014 at 1:55 PM, Markus Lanthaler
<markus.lanthaler@gmx.net> wrote:

[Morepath]
> Thanks for the pointer. I had a quick look at it. I find the routing idea (bind to models instead of views/controllers) quite interesting.

Thanks!

>>("give me the JSON for this object and put it inside this other
>> JSON").
>
> That's very interesting for things like collections I guess.

Exactly! It's very easy to write generic collections. Also generic
collections that contain links.

[snip]
> At least for me, this is highly interesting. Thanks

I'm very happy about that! I was writing Morepath with modern
REST-based applications in mind, so it's
good someone who is into this topic finds it interesting.

[snip]
>> I can't find examples of how a response actually points (deferences?)
>> to its documentation; I only see examples with a context directly
>
> It uses the same mechanism as discovery: an HTTP link header.

Aaah. I had expected there to be some kind of reference in it in the
context. I was totally focused on the context here. But why is the
context not
used for this purpose? Why this new mechanism? I thought the context
was the mechanism in JSON-LD to express things about the resource.
Aren't there now effectively two contexts?

To write a hydra client it would need to examine the context *and* the
HTTP link header in order to get the full information on how to deal
with a resource, correct?

> Here are two APIs (loaded in the Hydra API console) that illustrate how it works in practice:
>
> http://bit.ly/hydra-console-event-api
> http://bit.ly/hydra-api-demo

I've looked at them just now, I'll explore it some more.

[batch delete]

> AFAICT, you'd lose the visibility of the DELETE at the HTTP level because you'd have to use a different method (POST). It MAY reduce latency but nothing
> really prevents you from sending those DELETEs in parallel so I'm not sure how much gain if you really just send IDs. If you want to delete items based on
> same other criteria (delete all persons older than 18 years), we are talking about something completely different.

You're right. It's an old pattern I've seen in web applications for
years, but a HTTP DELETE operation sounds like a better approach.

[batch size]
>>> Indeed. The most straightforward solution would be to return a
>>> templated IRI to access a specific page directly. Alternatives would be
>>> things like a Prefer header (for page size).
>>
>> I myself really don't like using headers for this, as it makes it
>> impossible to pass around a URL to a particular batch (or generate
>> one, which I'm doing in Morepath).
>
> It is possible, but it would be the server's job to tell you the URL instead of having the client to construct those URLs.

I don't think I understand. Are you saying it is possible for a server
to give the client a URL that instructs it to use a Prefer header for
batch size?

[snip]
> or you embed this anonymous node (it's called a blank node) directly as follows:
>
>   {
>     "@context": "http://www.w3.org/ns/hydra/context.jsonld",
>     "@id": "http://api.example.com/an-issue/comments?page=3",
>     "@type": "PagedCollection",
>     "changePageSize": {
>       "@type": "IriTemplate",
>       "template": "http://api.example.com/an-issue/comment{?page,itemsPerPage}",
>       ...
>     }
>     ...
>   }

Ah, yes, I was thinking that might be possible, but I got distracted
by the discussion of the Link class and the TemplateLink class.
Perhaps that's something that can be made more clear in the spec.

>> If itemsPerPage is not deemed important, I think I'd have the same
>> issues if I were to combine a (batched) collection with a query API
>> using URL parameters.
>
> Does the above example clarify how it works?

Yes, somewhat.

JSON-LD is still gelling in my mind right now - I need to see where
example 3 sits in a larger JSON object, and also how you could assign
an iriTemplate an @id and then how you refer to that id again. I'm
going to look some more at your references and browse the specs some
more, then sleep on it. I'll have either better questions or better
answers in the morning. :)

Thank you for your help!

Regards,

Martijn

Received on Tuesday, 19 August 2014 12:39:38 UTC