Re: Link relation types for non-GET links

Mike Kelly <mikekelly321@gmail.com> Fri, 14 August 2015 07:07 UTC

Return-Path: <mikekelly321@gmail.com>
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 A2C1F1A009C for <link-relations@ietfa.amsl.com>; Fri, 14 Aug 2015 00:07:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.749
X-Spam-Level:
X-Spam-Status: No, score=-1.749 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-0.001] autolearn=no
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 qilC12_yuS5M for <link-relations@ietfa.amsl.com>; Fri, 14 Aug 2015 00:07:35 -0700 (PDT)
Received: from mail-la0-x234.google.com (mail-la0-x234.google.com [IPv6:2a00:1450:4010:c03::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7CCF61A00A0 for <link-relations@ietf.org>; Fri, 14 Aug 2015 00:07:34 -0700 (PDT)
Received: by lalv9 with SMTP id v9so38800535lal.0 for <link-relations@ietf.org>; Fri, 14 Aug 2015 00:07:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sEwU2Pda/D8d1lJHo0mKncRwJCrnFHK6L3n8Bro9s+o=; b=aXshQwDnG/cRVBepjWuLHRZTR0SgwskXkkhRYA8njr5Dpxc7e0p6k30U7hxaX1eNvF MVxbYglbYhN2rUSQ+EigEldRYE0OlVfaFwLWHLg/pbGM66cUtDPxVuS5EmOSIe5CO8BK 8lVdNBXPRK3PeNDo9CjEpGKCrBmhhwJEHYu7VczMadZsASfzRNXS7/+YZpMAKsdjzddv NVpll8ct3T1RW5O0H6hoyfn6016fQLWdCMkZ9yi3BUEZ76Y5EkYfvhRdifMQtax0ZWb4 IEdMiKpv/fQDsMP9NhL8vHXX2DezIDsngQuP1zUWr6baugXlkWjFPJRlRR5WERwKwkht C5ww==
MIME-Version: 1.0
X-Received: by 10.152.28.105 with SMTP id a9mr41872447lah.9.1439536052506; Fri, 14 Aug 2015 00:07:32 -0700 (PDT)
Received: by 10.112.118.71 with HTTP; Fri, 14 Aug 2015 00:07:31 -0700 (PDT)
Received: by 10.112.118.71 with HTTP; Fri, 14 Aug 2015 00:07:31 -0700 (PDT)
In-Reply-To: <CAAzbHvb==Sn_4UUFHKs3H9GYbEfiX=TUjv4FSmNi9R4NEB+DvQ@mail.gmail.com>
References: <CAAzbHvb==Sn_4UUFHKs3H9GYbEfiX=TUjv4FSmNi9R4NEB+DvQ@mail.gmail.com>
Date: Fri, 14 Aug 2015 08:07:31 +0100
Message-ID: <CANqiZJZ-JwFi8DLGE1iBp9t88KYcE=y=vsPr5EEQ6bYuA96Kxw@mail.gmail.com>
Subject: Re: Link relation types for non-GET links
From: Mike Kelly <mikekelly321@gmail.com>
To: Klaus Hartke <hartke@tzi.org>
Content-Type: multipart/alternative; boundary="089e0160a2400d2520051d401b69"
Archived-At: <http://mailarchive.ietf.org/arch/msg/link-relations/uTp8WCaNgob8kigkRY6_Gwb_1cU>
Cc: link-relations@ietf.org
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: Fri, 14 Aug 2015 07:07:36 -0000

Hi Klaus,

You can use a standard HAL link and a link relation if you ensure the link
relation is a URL which can be dereferenced to retrieve a machine-readable
description of the methods and messages that are possible for that link.
Just think of it as machine readable link relation documentation.

Cheers,
M

Sent from my mobile
On 6 Aug 2015 13:33, "Klaus Hartke" <hartke@tzi.org> wrote:

> Hi link relation type experts,
>
> I'm using links in my application to discover resources, and link
> relation types to indicate the semantics of a link. Now I'm stumbling
> on links that change the resource state when followed (i.e., links
> that cause requests with methods other than GET).
>
> RFC5988 says that link relation types "can specify the behaviours and
> properties of the target resource (e.g., allowable HTTP methods,
> [...])."
>
> However, none of the registered link relation types seems to do this.
> My question is: Have link relation types for non-GET links simply not
> been registered yet, or should a non-GET link perhaps be a different
> hypermedia control?
>
> For example, let's say I have a collection resource and want to
> provide a way for clients to add new collection items. So I would add
> a POST link that, when followed, creates the new item and updates the
> collection. What should the link relation type be in
> "http://example.org/collection has a ??? resource at
> http://example.org/collection"?
>
>   {
>     "_links": {
>       "terms-of-service": {
>         "href": "http://example.org/tos",
>         "type": "text/html"
>       },
>       "???": {
>         "href": "http://example.org/collection/"
>       }
>     }
>   }
>
>   (using HAL-like syntax [1])
>
> Or should I add the equivalent of an HTML form to my media type, and
> have a "form relation type" (for the lack of a better term) to
> identify the semantics? This would allow me to make statements of the
> form "To {relation type} the {context IRI}, make a {method} request to
> {target IRI}", e.g., "To create-a-new-item-in the
> http://example.org/collection, make a POST request to
> http://example.org/collection".
>
>   {
>     "_links": {
>       "terms-of-service": {
>         "href": "http://example.org/tos",
>         "type": "text/html"
>       },
>     },
>     "_forms": {
>       "create-a-new-item-in": {
>         "href": "http://example.org/collection/",
>         "method": "POST",
>         "accept": "application/x-www-form-urlencoded",
>         "fields": [ "firstName", "lastName", "eMail" ]
>       }
>     }
>   }
>
> Would it make sense to have a registry for common form relation types?
>
> Best regards,
> Klaus
>
> [1] https://tools.ietf.org/html/draft-kelly-json-hal-07
>
> _______________________________________________
> link-relations mailing list
> link-relations@ietf.org
> https://www.ietf.org/mailman/listinfo/link-relations
>