Re: Link relation types for non-GET links

Erik Wilde <dret@berkeley.edu> Sat, 15 August 2015 14:09 UTC

Return-Path: <dret@berkeley.edu>
X-Original-To: link-relations@ietfa.amsl.com
Delivered-To: link-relations@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CBB181A00ED for <link-relations@ietfa.amsl.com>; Sat, 15 Aug 2015 07:09:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.211
X-Spam-Level:
X-Spam-Status: No, score=-4.211 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dNRRG24xTlVd for <link-relations@ietfa.amsl.com>; Sat, 15 Aug 2015 07:09:19 -0700 (PDT)
Received: from cm01fe.IST.Berkeley.EDU (cm01fe.IST.Berkeley.EDU [169.229.218.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CF1F61A00D0 for <link-relations@ietf.org>; Sat, 15 Aug 2015 07:09:19 -0700 (PDT)
Received: from 205-237-53-208.static.cgocable.ca ([205.237.53.208] helo=dretair11.local) by cm01fe.ist.berkeley.edu with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.76) (auth plain:dret@berkeley.edu) (envelope-from <dret@berkeley.edu>) id 1ZQc97-0007Co-6N; Sat, 15 Aug 2015 07:09:19 -0700
Message-ID: <55CF480A.3090800@berkeley.edu>
Date: Sat, 15 Aug 2015 10:09:14 -0400
From: Erik Wilde <dret@berkeley.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version: 1.0
To: link-relations <link-relations@ietf.org>
Subject: Re: Link relation types for non-GET links
References: <CAAzbHvb==Sn_4UUFHKs3H9GYbEfiX=TUjv4FSmNi9R4NEB+DvQ@mail.gmail.com> <CAPW_8m5CU++j=8tNBK1Q7KszxsfORnK1-6mxcgUwz9X2R2JTyA@mail.gmail.com> <CAAzbHvZGYGNOkuAkc7Fu29maDcbjSf_o54q93Xa+Ggk_fkGHAw@mail.gmail.com> <55CD15FF.2060805@berkeley.edu> <CAAzbHvZMtGdzN4WE0OzmUEuY6Pi1JE-6rQqs-u_0pHMvX+Cd+w@mail.gmail.com>
In-Reply-To: <CAAzbHvZMtGdzN4WE0OzmUEuY6Pi1JE-6rQqs-u_0pHMvX+Cd+w@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/link-relations/ihGvpxVEdnfzOO0X0rKvbsH2AKY>
X-BeenThere: link-relations@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <link-relations.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/link-relations>, <mailto:link-relations-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/link-relations/>
List-Post: <mailto:link-relations@ietf.org>
List-Help: <mailto:link-relations-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/link-relations>, <mailto:link-relations-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 15 Aug 2015 14:09:22 -0000

hello klaus.

On 2015-08-15 08:21, Klaus Hartke wrote:
> Erik Wilde wrote:
>> not any more than it would make sense to have a generic GET relation type
>> that says "read"...
> The most common type of links in the web are simple <a href=""></a>
> links that could be interpreted as having a "read" relation type.

it's more a <html:a> relation type: it's an assertion the HTML author is 
making about the link source. and while none of the "implicit link 
relation types" (see my previous email) are registered as "explicit IANA 
link relation types", it still makes a lot of sense to look at them as 
being their own distinct ways how to interlink resources.

> IMO it makes sense to provide one link per action rather than
> providing a single "edit" link, because some actions might be invalid
> for the current state of the resource, or the user might not be
> authorized to perform all actions.

i think julian answered the general question well. however, i do agree 
with you that some designs could benefit from having runtime 
information. for example, while a general paging link could tell you 
that you can use a page number as parameter, at runtime it could be nice 
to let the client know that according to current resource state, there 
are 42 pages available. the UI then can reflect that.

this is the exact reason why 
https://github.com/dret/I-D/tree/master/link-desc exists: it should 
allow resources to embed runtime information, so that clients get more 
information than without it. of course, once the client sends the 
request, the 42 pages hay now be 41 or 43, and that's still something 
the client should be prepared to handle. but still, in some scenarios, 
UI design wants to show that "currently, there are 42 pages", and then 
runtime info is required.

>> defining a general-purpose format that captures all possible ways in which
>> link relations may have rules associated with them is hard, and personally,
>> my link description mentioned above draft has stalled because without a
>> better picture of what should and shouldn't be covered, this is a typical
>> "designing into the void" scenario.
> I'm not trying to design something; I'm trying to collect best
> practices. However, while safe links seem to be well understood, there
> does not really seem to be consensus on how hypermedia controls for
> manipulating resource states should look like.

the reason for this, in my opinion, is that people do this more on an 
ad-hoc basis. HTML forms are a good example, they do it (allowing 
GET/POST and defining URI parameter encoding), but in a way that's hard 
to reuse outside of HTML. 
https://github.com/dret/I-D/tree/master/link-desc is an attempt to turn 
this into a reusable model, but like i said in an earlier email, it's 
not easy to get right because there's a much greater variety of 
information that people might want to represent than with simple 
read/GET links.

> Based on what I've seen so far, to me it seems that such a hypermedia
> control is modelled best like safe links with the following
> information:
> * an identifier identifying the semantics of the hypermedia control
> (the relation type),
> * the subject of the hypermedia control (i.e., the resource that is
> being manipulated, the context), and
> * enough information for the client to construct a request to
> manipulate the resource, which includes
>         - the request method to use,
>         - the request URI to use, and
>         - a machine-readable description of the payload to include in
> the request.

feel free to cross reference this against 
https://github.com/dret/I-D/tree/master/link-desc. yes, media type would 
be good (a la Accept-Post), but then also URI template support, but 
there you also need to add some information about what the variables are 
supposed to represent.

to me, there's a good reason why this has been done ad-hoc and mostly in 
documented (and not completely machine-readable) form. it's the 
complexity of the design space. make it too simple and it's not 
expressive enough. make it expressive enough and it might become too 
cumbersome for most simpler use cases.

> So the major difference between a safe link and an unsafe one is the
> non-GET request method and the description of the payload. I don't
> think that a lot more than this is needed.

what about URI templates? those were very high up in the list of things 
we needed (see the "page number of paged collection" example above).

> (Background: people are looking for advice on how to build
> applications on top of CoAP [1]. I've started to collect some best
> practices in a draft [2], and made an attempt at defining some
> terminology for hypermedia controls [3]. The idea is, if we cannot
> provide advice for RESTful Web APIs in general, maybe it's possible to
> establish consensus on how RESTful Web APIs in constrained
> environments [4] should look like.)
> [1] https://tools.ietf.org/html/rfc7252
> [2] https://tools.ietf.org/html/draft-hartke-core-apps-01
> [3] https://tools.ietf.org/html/draft-hartke-core-apps-01#section-2.4
> [4] https://tools.ietf.org/html/rfc7228

interesting. it might be interesting to cross-check [3] with 
https://github.com/dret/hyperpedia/blob/master/concepts.md, which might 
have very similar goals. for hyperpedia, i have also started collecting 
formats (https://github.com/dret/hyperpedia/blob/master/formats.md), but 
still need to go through that list and see what kind of concepts the 
individual formats are supporting.

do you see anything missing from hyperpedia concepts that you think 
matters for your scenario? if so, please submit an issue, so that i can 
make sure that the concepts are as comprehensive as possible.

thanks and cheers,

dret.

-- 
erik wilde | mailto:dret@berkeley.edu  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |