[apps-discuss] media type for partial JSON updates?

Julian Reschke <julian.reschke@gmx.de> Thu, 29 December 2011 15:52 UTC

Return-Path: <julian.reschke@gmx.de>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D042621F844E for <apps-discuss@ietfa.amsl.com>; Thu, 29 Dec 2011 07:52:03 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -103.128
X-Spam-Level:
X-Spam-Status: No, score=-103.128 tagged_above=-999 required=5 tests=[AWL=-0.529, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FtqO0kd3yQmy for <apps-discuss@ietfa.amsl.com>; Thu, 29 Dec 2011 07:52:03 -0800 (PST)
Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by ietfa.amsl.com (Postfix) with SMTP id E648421F8876 for <apps-discuss@ietf.org>; Thu, 29 Dec 2011 07:51:57 -0800 (PST)
Received: (qmail invoked by alias); 29 Dec 2011 15:51:56 -0000
Received: from mail.greenbytes.de (EHLO [192.168.1.140]) [217.91.35.233] by mail.gmx.net (mp014) with SMTP; 29 Dec 2011 16:51:56 +0100
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX18C/3IQKyICn0Pm1oFYTBzbR4hJr19Q329Y/rV9z8 lsuut9oX3IeRco
Message-ID: <4EFC8C98.10901@gmx.de>
Date: Thu, 29 Dec 2011 16:51:52 +0100
From: Julian Reschke <julian.reschke@gmx.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1
MIME-Version: 1.0
To: IETF Apps Discuss <apps-discuss@ietf.org>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
Subject: [apps-discuss] media type for partial JSON updates?
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Dec 2011 15:52:03 -0000

Hi,

a few days ago, there was an epic thread over on rest-discuss 
(<http://tech.groups.yahoo.com/group/rest-discuss/message/18011>) on the 
use of HTTP PUT for partial updates of JSON-modeled data.

(Of course we all know over here that PUT isn't for partial updates :-)

However, apparently many people currently do this, as it's simply 
convenient to send a subset of the object and have the server just 
update those fields.

Now it's obvious that these kind of requests really should use PATCH, 
because that's what it's for after all. What's missing here is a media 
type describing this, though.

Should we document patch semantics for this use case, and define a 
matching media type?

It might be a light-weight alternative to what 
<https://tools.ietf.org/html/draft-pbryan-json-patch-04> describes. For 
example, taking the example from 
<https://tools.ietf.org/html/draft-pbryan-json-patch-04#appendix-A.5>:

    {
        "baz": "qux",
        "foo": "bar"
    }

    A JSON Patch document:

    [
          { "replace": "/baz", "value": "boo" }
    ]

    The resulting JSON document:

    {
        "baz": "boo",
        "foo": "bar"
    }

...the alternative notation would be...:


    {
        "baz": "boo"
    }

...sent with PATCH and an internet media type such as 
"application/partial-update-json".

Feedback appreciated,

Julian

PS: And yes, this would only allow replacing things; but this might be 
good enough for many use cases. Not defining something for this will 
cause people to stick with PUT, or to use PATCH with an incorrect media 
type, which we should avoid.