Link relation types for non-GET links

Klaus Hartke <hartke@tzi.org> Thu, 06 August 2015 12:33 UTC

Return-Path: <hartke@tzi.org>
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 021141B2E63 for <link-relations@ietfa.amsl.com>; Thu, 6 Aug 2015 05:33:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.971
X-Spam-Level:
X-Spam-Status: No, score=0.971 tagged_above=-999 required=5 tests=[BAYES_20=-0.001, FM_FORGED_GMAIL=0.622, HELO_EQ_DE=0.35] 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 71ZGy5svO60O for <link-relations@ietfa.amsl.com>; Thu, 6 Aug 2015 05:33:49 -0700 (PDT)
Received: from mailhost.informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B628E1B2E62 for <link-relations@ietf.org>; Thu, 6 Aug 2015 05:33:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from submithost.informatik.uni-bremen.de (submithost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::b]) by mailhost.informatik.uni-bremen.de (8.14.5/8.14.5) with ESMTP id t76CXilA029765 for <link-relations@ietf.org>; Thu, 6 Aug 2015 14:33:44 +0200 (CEST)
Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by submithost.informatik.uni-bremen.de (Postfix) with ESMTPSA id 3mn8Ph2dptz4vSv for <link-relations@ietf.org>; Thu, 6 Aug 2015 14:33:44 +0200 (CEST)
Received: by wijp15 with SMTP id p15so20723773wij.0 for <link-relations@ietf.org>; Thu, 06 Aug 2015 05:33:44 -0700 (PDT)
X-Received: by 10.180.219.41 with SMTP id pl9mr6002194wic.30.1438864424068; Thu, 06 Aug 2015 05:33:44 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.194.21.201 with HTTP; Thu, 6 Aug 2015 05:33:04 -0700 (PDT)
From: Klaus Hartke <hartke@tzi.org>
Date: Thu, 06 Aug 2015 14:33:04 +0200
Message-ID: <CAAzbHvb==Sn_4UUFHKs3H9GYbEfiX=TUjv4FSmNi9R4NEB+DvQ@mail.gmail.com>
Subject: Link relation types for non-GET links
To: link-relations@ietf.org
Content-Type: text/plain; charset="UTF-8"
Archived-At: <http://mailarchive.ietf.org/arch/msg/link-relations/-upcOgOyWavF00a1baI9g5kv8Hc>
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: Thu, 06 Aug 2015 12:33:51 -0000

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