The application/json-merge-patch Media Type
draft-ietf-appsawg-json-merge-patch-01

The information below is for an old version of the document
Document Type Active Internet-Draft (appsawg WG)
Author James Snell 
Last updated 2013-09-17
Replaces draft-snell-merge-patch
Stream IETF
Intended RFC status (None)
Formats pdf htmlized (tools) htmlized bibtex
Reviews
Stream WG state WG Document
Document shepherd Murray Kucherawy
IESG IESG state I-D Exists
Consensus Boilerplate Unknown
Telechat date
Responsible AD (None)
Send notices to (None)
Applications Area Working Group                                 J. Snell
Internet-Draft
Intended status: Standards Track                      September 17, 2013
Expires: March 21, 2014

              The application/json-merge-patch Media Type
                 draft-ietf-appsawg-json-merge-patch-01

Abstract

   This specification defines the application/json-merge-patch media
   type and its intended use with the HTTP PATCH method defined by RFC
   5789.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on March 21, 2014.

Copyright Notice

   Copyright (c) 2013 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Snell                    Expires March 21, 2014                 [Page 1]
Internet-Draft           application/merge-patch          September 2013

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  The "application/json-merge-patch" Media Type . . . . . . . .   3
   3.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   6
   4.  Security Considerations . . . . . . . . . . . . . . . . . . .   7
   5.  Normative References  . . . . . . . . . . . . . . . . . . . .   7
   Appendix A.  Example Test Cases . . . . . . . . . . . . . . . . .   7
   Appendix B.  Example JavaScript Implementation  . . . . . . . . .   9
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .  10

1.  Introduction

   This specification defines the JSON "Merge Patch" document format,
   processing rules, and associated MIME media type identifier.  The
   Merge Patch format is primarily intended for use with the HTTP PATCH
   method [RFC5789] as a means of describing a set of modifications to a
   subset of target resource's content.

   For example, given the following original JSON document:

   {
     "a": "b",
     "c": {
       "d": "e"
     }
   }

   A change to the value of the "a" member can be described simply as:

     PATCH /target HTTP/1.1
     Host: example.org
     Content-Type: application/json-merge-patch

     {"a": "z"}

   When applied to the target resource, only the value of the "a" member
   will be modified, leaving the remaining content untouched.

   The Merge Patch format generally supports two types of changes:
   removing and setting JSON object members.  JSON arrays are
   essentially treated the same as JSON primitives: the existing value
   is replaced, but not partially modified.  The JSON null value is
   given a special meaning to indicate the removal of an existing value.
   These constraints allow Merge Patch to use a format that closely
   mimics the document being modified.  The constraints mean Merge Patch

Snell                    Expires March 21, 2014                 [Page 2]
Internet-Draft           application/merge-patch          September 2013

   is suitable for patching JSON documents that primarily use objects
   for their structure, and do not make use of explicit null values.
   The Merge Patch format is not appropriate for all JSON syntaxes.

   In this document, the key words "MUST", "MUST NOT", "REQUIRED",
   "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
   and "OPTIONAL" are to be interpreted as described in [RFC2119].

2.  The "application/json-merge-patch" Media Type

   The "application/json-merge-patch" Media Type is used to identify
   JSON documents that describe, by example, a set of changes that are
   to be made to a target resource.  When used within an HTTP PATCH
   request, it is the responsibility of the server receiving and
   processing the request to inspect the payload entity and determine
   the specific set of operations that are to be performed to modify the
   target resource.

   For example, given the following example JSON document:
Show full document text