<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" consensus="true" docName="draft-ietf-core-senml-etch-07" indexInclude="true" ipr="trust200902" number="8790" prepTime="2020-06-30T14:17:28" scripts="Common,Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocInclude="true" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-core-senml-etch-07" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc8790" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="FETCH and PATCH with SenML">FETCH and PATCH with Sensor Measurement Lists (SenML)</title>
    <seriesInfo name="RFC" value="8790" stream="IETF"/>
    <author initials="A." surname="Keränen" fullname="Ari Keränen">
      <organization showOnFrontPage="true">Ericsson</organization>
      <address>
        <postal>
          <street/>
          <city>Jorvas</city>
          <code>02420</code>
          <country>Finland</country>
        </postal>
        <email>ari.keranen@ericsson.com</email>
      </address>
    </author>
    <author initials="M." surname="Mohajer" fullname="Mojan Mohajer">
      <organization showOnFrontPage="true"/>
      <address>
        <email>mojanm@hotmail.com</email>
      </address>
    </author>
    <date month="06" year="2020"/>
    <keyword>CoAP</keyword>
    <keyword>IoT</keyword>
    <keyword>data model</keyword>
    <abstract pn="section-abstract">
      <t pn="section-abstract-1">The Sensor Measurement Lists (SenML) media type and data model can be
      used to send collections of resources, such as batches of sensor data or
      configuration parameters. The Constrained Application Protocol (CoAP)
      FETCH, PATCH, and iPATCH methods enable accessing and updating parts of
      a resource or multiple resources with one request. This document defines
      new media types for the CoAP FETCH, PATCH, and iPATCH methods for
      resources represented using the SenML data model.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t pn="section-boilerplate.1-1">
            This is an Internet Standards Track document.
        </t>
        <t pn="section-boilerplate.1-2">
            This document is a product of the Internet Engineering Task Force
            (IETF).  It represents the consensus of the IETF community.  It has
            received public review and has been approved for publication by
            the Internet Engineering Steering Group (IESG).  Further
            information on Internet Standards is available in Section 2 of 
            RFC 7841.
        </t>
        <t pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc8790" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t pn="section-boilerplate.2-1">
            Copyright (c) 2020 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) 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.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t keepWithNext="true" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
          </li>
          <li pn="section-toc.1-1.2">
            <t keepWithNext="true" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-terminology">Terminology</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-using-fetch-and-ipatch-with">Using FETCH and (i)PATCH with SenML</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2">
              <li pn="section-toc.1-1.3.2.1">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.1.1"><xref derivedContent="3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-senml-fetch">SenML FETCH</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.2">
                <t pn="section-toc.1-1.3.2.2.1"><xref derivedContent="3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-senml-ipatch">SenML (i)PATCH</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.4">
            <t pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-fragment-identification">Fragment Identification</xref></t>
          </li>
          <li pn="section-toc.1-1.5">
            <t pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-extensibility">Extensibility</xref></t>
          </li>
          <li pn="section-toc.1-1.6">
            <t pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.7">
            <t pn="section-toc.1-1.7.1"><xref derivedContent="7" format="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.7.2">
              <li pn="section-toc.1-1.7.2.1">
                <t pn="section-toc.1-1.7.2.1.1"><xref derivedContent="7.1" format="counter" sectionFormat="of" target="section-7.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-coap-content-format-registr">CoAP Content-Format Registration</xref></t>
              </li>
              <li pn="section-toc.1-1.7.2.2">
                <t pn="section-toc.1-1.7.2.2.1"><xref derivedContent="7.2" format="counter" sectionFormat="of" target="section-7.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-senml-etchjson-media-type">senml-etch+json Media Type</xref></t>
              </li>
              <li pn="section-toc.1-1.7.2.3">
                <t pn="section-toc.1-1.7.2.3.1"><xref derivedContent="7.3" format="counter" sectionFormat="of" target="section-7.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-senml-etchcbor-media-type">senml-etch+cbor Media Type</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.8">
            <t pn="section-toc.1-1.8.1"><xref derivedContent="8" format="counter" sectionFormat="of" target="section-8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.8.2">
              <li pn="section-toc.1-1.8.2.1">
                <t pn="section-toc.1-1.8.2.1.1"><xref derivedContent="8.1" format="counter" sectionFormat="of" target="section-8.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.8.2.2">
                <t pn="section-toc.1-1.8.2.2.1"><xref derivedContent="8.2" format="counter" sectionFormat="of" target="section-8.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.9">
            <t pn="section-toc.1-1.9.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.a"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgements">Acknowledgements</xref></t>
          </li>
          <li pn="section-toc.1-1.10">
            <t pn="section-toc.1-1.10.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-addresses">Authors' Addresses</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t pn="section-1-1">The Sensor Measurement Lists (SenML) media type <xref target="RFC8428" format="default" sectionFormat="of" derivedContent="RFC8428"/> and data
model can be used to transmit collections of resources, such as
batches of sensor data or configuration parameters.</t>
      <t pn="section-1-2">An example of a SenML collection is shown below:</t>
      <sourcecode name="" type="json" markers="false" pn="section-1-3">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":true},
 {"n":"5851", "v":42},
 {"n":"5750", "vs":"Ceiling light"}
]
</sourcecode>
      <t pn="section-1-4">Here, three resources, "3311/0/5850", "3311/0/5851", and "3311/0/5750",
of a dimmable light smart object <xref target="IPSO" format="default" sectionFormat="of" derivedContent="IPSO"/> are represented using
a single SenML Pack with three SenML Records. All resources share the
same base name "2001:db8::2/3311/0/"; hence, full names for the resources
are "2001:db8::2/3311/0/5850", etc.</t>
      <t pn="section-1-5">The CoAP <xref target="RFC7252" format="default" sectionFormat="of" derivedContent="RFC7252"/> FETCH, PATCH, and iPATCH methods <xref target="RFC8132" format="default" sectionFormat="of" derivedContent="RFC8132"/>
enable accessing and updating parts of a resource or multiple resources
with one request.</t>
      <t pn="section-1-6">This document defines two new media types, one using the JavaScript
Object Notation (JSON) <xref target="RFC8259" format="default" sectionFormat="of" derivedContent="RFC8259"/> and one using the Concise Binary
Object Representation (CBOR) <xref target="RFC7049" format="default" sectionFormat="of" derivedContent="RFC7049"/>, which can be used with the
CoAP FETCH, PATCH, and iPATCH methods for resources represented using the
SenML data model (i.e., for both SenML and Sensor Streaming Measurement
Lists (SenSML) data). The rest of the document uses the term "(i)PATCH" when
referring to both methods as the semantics of the new media types are the
same for the CoAP PATCH and iPATCH methods.</t>
    </section>
    <section anchor="terminology" numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-terminology">Terminology</name>
      <t pn="section-2-1">
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
    "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>",
    "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are
    to be interpreted as described in BCP 14 <xref target="RFC2119" format="default" sectionFormat="of" derivedContent="RFC2119"/>
        <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> when, and only when, they appear in all capitals,
    as shown here.
      </t>
      <t pn="section-2-2">Readers should also be familiar with the terms and concepts discussed
in <xref target="RFC8132" format="default" sectionFormat="of" derivedContent="RFC8132"/> and <xref target="RFC8428" format="default" sectionFormat="of" derivedContent="RFC8428"/>. The following additional terms are used in
this document:</t>
      <dl newline="false" spacing="normal" pn="section-2-3">
        <dt pn="section-2-3.1">Fetch Record:</dt>
        <dd pn="section-2-3.2">
  One set of parameters that is used to match SenML Record(s).</dd>
        <dt pn="section-2-3.3">Fetch Pack:</dt>
        <dd pn="section-2-3.4">
  One or more Fetch Records in an array structure.</dd>
        <dt pn="section-2-3.5">Patch Record:</dt>
        <dd pn="section-2-3.6">
  One set of parameters similar to Fetch Record but also containing
instructions on how to change existing SenML Pack(s).</dd>
        <dt pn="section-2-3.7">Patch Pack:</dt>
        <dd pn="section-2-3.8">
  One or more Patch Records in an array structure.</dd>
        <dt pn="section-2-3.9">Target Record:</dt>
        <dd pn="section-2-3.10">
  A Record in a SenML Pack that matches the selection criteria of
a Fetch or Patch Record and hence is a target for a Fetch or Patch
operation.</dd>
        <dt pn="section-2-3.11">Target Pack:</dt>
        <dd pn="section-2-3.12">
  A SenML Pack that is a target for a Fetch or Patch operation.</dd>
        <dt pn="section-2-3.13">(i)PATCH:</dt>
        <dd pn="section-2-3.14">
  A term that refers to both CoAP "PATCH" and "iPATCH" methods when
there is no difference in this specification as to which one is used.</dd>
      </dl>
    </section>
    <section anchor="using-fetch-and-ipatch-with-senml" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-using-fetch-and-ipatch-with">Using FETCH and (i)PATCH with SenML</name>
      <t pn="section-3-1">The FETCH/(i)PATCH media types for SenML are modeled as extensions to the
SenML media type to enable reuse of existing SenML parsers and
generators, in particular on constrained devices. Unless mentioned
otherwise, FETCH and PATCH Packs are constructed with the same rules and
constraints as SenML Packs.</t>
      <t pn="section-3-2">The key differences from the SenML media type are allowing the use of a
"null" value for removing Records with the (i)PATCH method and the lack of
value fields in Fetch Records. Also, the Fetch and Patch Records do not
have a default time or base version when the fields are omitted.</t>
      <section anchor="senml-fetch" numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-senml-fetch">SenML FETCH</name>
        <t pn="section-3.1-1">The FETCH method can be used to select and return a subset of Records, in
sequence, of one or more SenML Packs. The SenML Records are selected by
giving a set of names that, when resolved, match resolved names in a
Target SenML Pack. The names for a Fetch Pack are given using the SenML
"name" and/or "base name" fields. The names are resolved by concatenating
the base name with the name field as defined in <xref target="RFC8428" format="default" sectionFormat="of" derivedContent="RFC8428"/>.</t>
        <t pn="section-3.1-2">A Fetch Pack <bcp14>MUST</bcp14> contain at least one Fetch Record. A Fetch Record <bcp14>MUST</bcp14>
contain a name and/or base name field.</t>
        <t pn="section-3.1-3">For example, to select the resources "5850" and "5851" from the
example in <xref target="intro" format="default" sectionFormat="of" derivedContent="Section 1"/>, the following Fetch Pack can be used:</t>
        <sourcecode name="" type="json" markers="false" pn="section-3.1-4">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850"},
 {"n":"5851"}
]
</sourcecode>
        <t pn="section-3.1-5">The result of a FETCH request with the example above would be:</t>
        <sourcecode name="" type="json" markers="false" pn="section-3.1-6">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":true},
 {"n":"5851", "v":42},
]
</sourcecode>
        <t pn="section-3.1-7">The SenML time and unit fields can be used in a Fetch Record to further
narrow the selection of matched SenML Records. When no time or unit is
given in a Fetch Record, all SenML Records with the given name are
matched (i.e., unlike with SenML Records, the lack of time field in a Fetch
Record does not imply a time value of zero). 

When time is given in the Fetch
Record, a Target Record is matched only when its resolved time value and name
are equal to those of the Fetch Record. Similarly, when unit is given, a
Target Record is matched only when its resolved unit and name are equal to
those of the Fetch Record. If both the time and unit are given in the Fetch
Record, a Target Record is matched only when both are equal to those of the
Fetch Record. Each Target Record <bcp14>MUST</bcp14> be included in the response at
most once, even if multiple Fetch Records match with the same Target
Record.</t>
        <t pn="section-3.1-8">For example, if the resource "5850" had multiple sensor
	readings (SenML Records) with different time values, the following Fetch
Pack can be used to retrieve the Record with time "1.276020091e+09":</t>
        <sourcecode name="" type="json" markers="false" pn="section-3.1-9">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850", "t":1.276020091e+09}
]
</sourcecode>
        <t pn="section-3.1-10">The resolved form of Records (<xref target="RFC8428" sectionFormat="of" section="4.6" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8428#section-4.6" derivedContent="RFC8428"/>) is used when
comparing the names, times, and units of the Target and Fetch Records to
accommodate differences in the use of the base values. In the resolved form,
the SenML name in the example above becomes "2001:db8::2/3311/0/5850".
Since there is no base time in the Pack, the time in resolved form is
equal to the time in the example.</t>
        <t pn="section-3.1-11">If no SenML Records match, an empty SenML Pack (i.e., array with no
elements) is returned as a response.</t>
        <t pn="section-3.1-12">Fetch Records <bcp14>MUST NOT</bcp14> contain other fields than
	name, base name, time,
base time, unit, and base unit. Implementations <bcp14>MUST</bcp14> reject and generate
an error for a Fetch Pack with other fields. <xref target="RFC8132" sectionFormat="comma" section="2.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8132#section-2.2" derivedContent="RFC8132"/> provides guidance for FETCH request error handling, e.g., using the 4.22
(Unprocessable Entity) CoAP error response code.</t>
      </section>
      <section anchor="senml-ipatch" numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-senml-ipatch">SenML (i)PATCH</name>
        <t pn="section-3.2-1">The (i)PATCH method can be used to change the fields of SenML Records, to
add new Records, and to remove existing Records. The names, times, and
units of the Patch Records are given and matched in the same way as for the
Fetch Records, except each Patch Record <bcp14>MUST</bcp14> match at most one Target
Record. A Patch Record matching more than one Target Record is considered
invalid (patching multiple Target Records with one Patch Record would
result in multiple copies of the same Record). Patch Packs can also
include new values and other SenML fields for the Records. Application of
Patch Packs is idempotent; hence, the PATCH and iPATCH methods for SenML Packs
are equivalent.</t>
        <t pn="section-3.2-2">When the name in a Patch Record matches with the name in an existing
Record, the resolved time values and units (if any) are compared. If the
time values and units either do not exist in both Records or are equal,
the Target Record is replaced with the contents of the Patch Record. All
Patch Records <bcp14>MUST</bcp14> contain at least a SenML Value or Sum field.</t>
        <t pn="section-3.2-3">If a Patch Record contains a name, or the combination of a time value, unit,
and  name, that does not exist in any existing Record in the Pack, the
given Record, with all the fields it contains, is added to the Pack.</t>
        <t pn="section-3.2-4">If a Patch Record has a value ("v") field with a null value, it <bcp14>MUST NOT</bcp14> be
added, but the matched Record (if any) is removed from the Target Pack.</t>
        <t pn="section-3.2-5">The Patch Records <bcp14>MUST</bcp14> be applied in the same
	sequence as they are in the
Patch Pack. If multiple Patch Packs are being processed at the same time,
the result <bcp14>MUST</bcp14> be equivalent to applying them in one sequence.</t>
        <t pn="section-3.2-6">Implementations <bcp14>MUST</bcp14> reject and generate an error for Patch Packs with
invalid Records. If a Patch Pack is rejected, the state of the Target
Pack is not changed, i.e., either all or none of the Patch Records are
applied. <xref target="RFC8132" sectionFormat="comma" section="3.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8132#section-3.4" derivedContent="RFC8132"/> provides guidance for error handling
with PATCH and iPATCH requests, e.g., using the 4.22 (Unprocessable
Entity) and 4.09 (Conflict) CoAP error response codes.</t>
        <t pn="section-3.2-7">For example, the following document could be given as an (i)PATCH payload
to change/set the values of two SenML Records for the example in
<xref target="intro" format="default" sectionFormat="of" derivedContent="Section 1"/>:</t>
        <sourcecode name="" type="json" markers="false" pn="section-3.2-8">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":false},
 {"n":"5851", "v":10}
]
</sourcecode>
        <t pn="section-3.2-9">If the request is successful, the resulting representation of the
example SenML Pack would be as follows:</t>
        <sourcecode name="" type="json" markers="false" pn="section-3.2-10">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850", "vb":false},
 {"n":"5851", "v":10},
 {"n":"5750", "vs":"Ceiling light"}
]
</sourcecode>
        <t pn="section-3.2-11">As another example, the following document could be given as an (i)PATCH
payload to remove the two SenML Records:</t>
        <sourcecode name="" type="json" markers="false" pn="section-3.2-12">
[
 {"bn":"2001:db8::2/3311/0/", "n":"5850", "v":null},
 {"n":"5851", "v":null}
]
</sourcecode>
      </section>
    </section>
    <section anchor="fragment-identification" numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-fragment-identification">Fragment Identification</name>
      <t pn="section-4-1">Fragment identification for Records of Fetch and Patch Packs uses the
same mechanism as SenML JSON/CBOR fragment identification (see <xref target="RFC8428" sectionFormat="of" section="9" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8428#section-9" derivedContent="RFC8428"/>), i.e., the "rec" scheme followed by a comma-separated list of
Record positions or range(s) of Records. For example, to select the 3rd
and 5th Record of a Fetch or Patch Pack, a fragment identifier "rec=3,5"
can be used in the URI of the Fetch or Patch Pack resource.</t>
    </section>
    <section anchor="extensibility" numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-extensibility">Extensibility</name>
      <t pn="section-5-1">The SenML mandatory-to-understand field extensibility mechanism (see
<xref target="RFC8428" sectionFormat="of" section="4.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8428#section-4.4" derivedContent="RFC8428"/>) does not apply to Patch Packs, i.e., unknown
fields <bcp14>MUST NOT</bcp14> generate an error, but such fields are treated like any
other field (e.g., added to Patch target Records where applicable).</t>
      <t pn="section-5-2">This specification allows only a small subset of SenML fields in Fetch
Records, but future specifications may enable new fields for Fetch Records
and possibly also new fields for selecting targets for Patch Records.</t>
    </section>
    <section anchor="seccons" numbered="true" toc="include" removeInRFC="false" pn="section-6">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t pn="section-6-1">The security and privacy considerations of SenML also apply to the
FETCH and (i)PATCH methods. CoAP's security mechanisms are used to
provide security for the FETCH and (i)PATCH methods.</t>
      <t pn="section-6-2">In FETCH and (i)PATCH requests, the client can pass arbitrary names to
the target resource for manipulation. The resource implementer must take
care to only allow access to names that are actually part of (or
accessible through) the target resource. In particular, the receiver needs
to ensure that any input does not lead to uncontrolled special
interpretation by the system.</t>
      <t pn="section-6-3">If the client is not allowed to do a GET or PUT on the full target
resource (and thus all the names accessible through it), access
control rules must be evaluated for each Record in the Pack.</t>
    </section>
    <section anchor="iana" numbered="true" toc="include" removeInRFC="false" pn="section-7">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t pn="section-7-1">This document registers two new media types and CoAP Content-Format IDs
for both media types.</t>
      <section anchor="coap-content-format-registration" numbered="true" toc="include" removeInRFC="false" pn="section-7.1">
        <name slugifiedName="name-coap-content-format-registr">CoAP Content-Format Registration</name>
        <t pn="section-7.1-1">IANA has assigned CoAP Content-Format IDs for the SenML PATCH
and FETCH media types in the "CoAP Content-Formats" subregistry, within
the "Constrained RESTful Environments (CoRE) Parameters" registry <xref target="RFC7252" format="default" sectionFormat="of" derivedContent="RFC7252"/>. The assigned IDs are shown in
<xref target="tbl-coap-content-formats" format="default" sectionFormat="of" derivedContent="Table 1"/>.</t>
        <table anchor="tbl-coap-content-formats" align="center" pn="table-1">
          <name slugifiedName="name-coap-content-format-ids">CoAP Content-Format IDs</name>
          <thead>
            <tr>
              <th align="left" colspan="1" rowspan="1">Media Type</th>
              <th align="left" colspan="1" rowspan="1">Encoding</th>
              <th align="left" colspan="1" rowspan="1">ID</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left" colspan="1" rowspan="1">application/senml-etch+json</td>
              <td align="left" colspan="1" rowspan="1">-</td>
              <td align="left" colspan="1" rowspan="1">320</td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">application/senml-etch+cbor</td>
              <td align="left" colspan="1" rowspan="1">-</td>
              <td align="left" colspan="1" rowspan="1">322</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section anchor="senml-etchjson-media-type" numbered="true" toc="include" removeInRFC="false" pn="section-7.2">
        <name slugifiedName="name-senml-etchjson-media-type">senml-etch+json Media Type</name>
        <dl newline="false" spacing="normal" pn="section-7.2-1">
          <dt pn="section-7.2-1.1">Type name:</dt>
          <dd pn="section-7.2-1.2">application</dd>
          <dt pn="section-7.2-1.3">Subtype name:</dt>
          <dd pn="section-7.2-1.4">senml-etch+json</dd>
          <dt pn="section-7.2-1.5">Required parameters:</dt>
          <dd pn="section-7.2-1.6">N/A</dd>
          <dt pn="section-7.2-1.7">Optional parameters:</dt>
          <dd pn="section-7.2-1.8">N/A</dd>
          <dt pn="section-7.2-1.9">Encoding considerations:</dt>
          <dd pn="section-7.2-1.10">binary</dd>
          <dt pn="section-7.2-1.11">Security considerations:</dt>
          <dd pn="section-7.2-1.12">See <xref target="seccons" format="default" sectionFormat="of" derivedContent="Section 6"/> of RFC 8790.</dd>
          <dt pn="section-7.2-1.13">Interoperability considerations:</dt>
          <dd pn="section-7.2-1.14">N/A</dd>
          <dt pn="section-7.2-1.15">Published specification:</dt>
          <dd pn="section-7.2-1.16">RFC 8790</dd>
          <dt pn="section-7.2-1.17">Applications that use this media type:</dt>
          <dd pn="section-7.2-1.18">Applications that use the
SenML media type for resource representation.</dd>
          <dt pn="section-7.2-1.19">Fragment identifier considerations:</dt>
          <dd pn="section-7.2-1.20">Fragment identification for
application/senml-etch+json is supported by using fragment identifiers as
specified by <xref target="fragment-identification" format="default" sectionFormat="of" derivedContent="Section 4"/> of RFC 8790.</dd>
          <dt pn="section-7.2-1.21">Additional information:</dt>
          <dd pn="section-7.2-1.22">
            <t pn="section-7.2-1.22.1"><br/></t>
            <dl newline="false" spacing="normal" pn="section-7.2-1.22.2">
              <dt pn="section-7.2-1.22.2.1">Deprecated alias names for this type:</dt>
              <dd pn="section-7.2-1.22.2.2">N/A</dd>
              <dt pn="section-7.2-1.22.2.3">Magic number(s):</dt>
              <dd pn="section-7.2-1.22.2.4">N/A</dd>
              <dt pn="section-7.2-1.22.2.5">File extension(s):</dt>
              <dd pn="section-7.2-1.22.2.6">senml-etchj</dd>
              <dt pn="section-7.2-1.22.2.7">Windows Clipboard Name:</dt>
              <dd pn="section-7.2-1.22.2.8">"SenML FETCH/PATCH format"</dd>
              <dt pn="section-7.2-1.22.2.9">Macintosh file type code(s):</dt>
              <dd pn="section-7.2-1.22.2.10">N/A</dd>
              <dt pn="section-7.2-1.22.2.11">Macintosh Universal Type Identifier code:</dt>
              <dd pn="section-7.2-1.22.2.12">
                <t pn="section-7.2-1.22.2.12.1"><br/>org.ietf.senml-etch-json
  conforms to public.text</t>
              </dd>
            </dl>
          </dd>
          <dt pn="section-7.2-1.23">Person &amp; email address to contact for further
information:</dt>
          <dd pn="section-7.2-1.24">
            <t pn="section-7.2-1.24.1"><br/><contact fullname="Ari Keränen"/> &lt;ari.keranen@ericsson.com&gt;</t>
          </dd>
          <dt pn="section-7.2-1.25">Intended usage:</dt>
          <dd pn="section-7.2-1.26">COMMON</dd>
          <dt pn="section-7.2-1.27">Restrictions on usage:</dt>
          <dd pn="section-7.2-1.28">N/A</dd>
          <dt pn="section-7.2-1.29">Author:</dt>
          <dd pn="section-7.2-1.30">
            <t pn="section-7.2-1.30.1"><contact fullname="Ari Keränen"/> &lt;ari.keranen@ericsson.com&gt;</t>
          </dd>
          <dt pn="section-7.2-1.31">Change controller:</dt>
          <dd pn="section-7.2-1.32">IESG</dd>
        </dl>
      </section>
      <section anchor="senml-etchcbor-media-type" numbered="true" toc="include" removeInRFC="false" pn="section-7.3">
        <name slugifiedName="name-senml-etchcbor-media-type">senml-etch+cbor Media Type</name>
        <dl newline="false" spacing="normal" pn="section-7.3-1">
          <dt pn="section-7.3-1.1">Type name:</dt>
          <dd pn="section-7.3-1.2">application</dd>
          <dt pn="section-7.3-1.3">Subtype name:</dt>
          <dd pn="section-7.3-1.4">senml-etch+cbor</dd>
          <dt pn="section-7.3-1.5">Required parameters:</dt>
          <dd pn="section-7.3-1.6">N/A</dd>
          <dt pn="section-7.3-1.7">Optional parameters:</dt>
          <dd pn="section-7.3-1.8">N/A</dd>
          <dt pn="section-7.3-1.9">Encoding considerations:</dt>
          <dd pn="section-7.3-1.10">binary</dd>
          <dt pn="section-7.3-1.11">Security considerations:</dt>
          <dd pn="section-7.3-1.12">See <xref target="seccons" format="default" sectionFormat="of" derivedContent="Section 6"/> of RFC 8790.</dd>
          <dt pn="section-7.3-1.13">Interoperability considerations:</dt>
          <dd pn="section-7.3-1.14">N/A</dd>
          <dt pn="section-7.3-1.15">Published specification:</dt>
          <dd pn="section-7.3-1.16">RFC 8790</dd>
          <dt pn="section-7.3-1.17">Applications that use this media type:</dt>
          <dd pn="section-7.3-1.18">Applications that use the
SenML media type for resource representation.</dd>
          <dt pn="section-7.3-1.19">Fragment identifier considerations:</dt>
          <dd pn="section-7.3-1.20">Fragment identification for
application/senml-etch+cbor is supported by using fragment identifiers as
specified by <xref target="fragment-identification" format="default" sectionFormat="of" derivedContent="Section 4"/> of RFC 8790.</dd>
          <dt pn="section-7.3-1.21">Additional information:</dt>
          <dd pn="section-7.3-1.22">
            <t pn="section-7.3-1.22.1"><br/></t>
            <dl newline="false" spacing="normal" pn="section-7.3-1.22.2">
              <dt pn="section-7.3-1.22.2.1">Deprecated alias names for this type:</dt>
              <dd pn="section-7.3-1.22.2.2">N/A</dd>
              <dt pn="section-7.3-1.22.2.3">Magic number(s):</dt>
              <dd pn="section-7.3-1.22.2.4">N/A</dd>
              <dt pn="section-7.3-1.22.2.5">File extension(s):</dt>
              <dd pn="section-7.3-1.22.2.6">senml-etchc</dd>
              <dt pn="section-7.3-1.22.2.7">Macintosh file type code(s):</dt>
              <dd pn="section-7.3-1.22.2.8">N/A</dd>
              <dt pn="section-7.3-1.22.2.9">Macintosh Universal Type Identifier code:</dt>
              <dd pn="section-7.3-1.22.2.10">
                <t pn="section-7.3-1.22.2.10.1"><br/>org.ietf.senml-etch-cbor conforms to public.data</t>
              </dd>
            </dl>
          </dd>
          <dt pn="section-7.3-1.23">Person &amp; email address to contact for further information:</dt>
          <dd pn="section-7.3-1.24">
            <t pn="section-7.3-1.24.1"><br/><contact fullname="Ari Keränen"/> &lt;ari.keranen@ericsson.com&gt;</t>
          </dd>
          <dt pn="section-7.3-1.25">Intended usage:</dt>
          <dd pn="section-7.3-1.26">COMMON</dd>
          <dt pn="section-7.3-1.27">Restrictions on usage:</dt>
          <dd pn="section-7.3-1.28">N/A</dd>
          <dt pn="section-7.3-1.29">Author:</dt>
          <dd pn="section-7.3-1.30">
            <t pn="section-7.3-1.30.1"><contact fullname="Ari Keränen"/> &lt;ari.keranen@ericsson.com&gt;</t>
          </dd>
          <dt pn="section-7.3-1.31">Change controller:</dt>
          <dd pn="section-7.3-1.32">IESG</dd>
        </dl>
      </section>
    </section>
  </middle>
  <back>
    <references pn="section-8">
      <name slugifiedName="name-references">References</name>
      <references pn="section-8.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="March"/>
            <abstract>
              <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC7049" target="https://www.rfc-editor.org/info/rfc7049" quoteTitle="true" derivedAnchor="RFC7049">
          <front>
            <title>Concise Binary Object Representation (CBOR)</title>
            <author initials="C." surname="Bormann" fullname="C. Bormann">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="P." surname="Hoffman" fullname="P. Hoffman">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2013" month="October"/>
            <abstract>
              <t>The Concise Binary Object Representation (CBOR) is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation.  These design goals make it different from earlier binary serializations such as ASN.1 and MessagePack.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7049"/>
          <seriesInfo name="DOI" value="10.17487/RFC7049"/>
        </reference>
        <reference anchor="RFC7252" target="https://www.rfc-editor.org/info/rfc7252" quoteTitle="true" derivedAnchor="RFC7252">
          <front>
            <title>The Constrained Application Protocol (CoAP)</title>
            <author initials="Z." surname="Shelby" fullname="Z. Shelby">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="K." surname="Hartke" fullname="K. Hartke">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="C." surname="Bormann" fullname="C. Bormann">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2014" month="June"/>
            <abstract>
              <t>The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use with constrained nodes and constrained (e.g., low-power, lossy) networks.  The nodes often have 8-bit microcontrollers with small amounts of ROM and RAM, while constrained networks such as IPv6 over Low-Power Wireless Personal Area Networks (6LoWPANs) often have high packet error rates and a typical throughput of 10s of kbit/s.  The protocol is designed for machine- to-machine (M2M) applications such as smart energy and building automation.</t>
              <t>CoAP provides a request/response interaction model between application endpoints, supports built-in discovery of services and resources, and includes key concepts of the Web such as URIs and Internet media types.  CoAP is designed to easily interface with HTTP for integration with the Web while meeting specialized requirements such as multicast support, very low overhead, and simplicity for constrained environments.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7252"/>
          <seriesInfo name="DOI" value="10.17487/RFC7252"/>
        </reference>
        <reference anchor="RFC8132" target="https://www.rfc-editor.org/info/rfc8132" quoteTitle="true" derivedAnchor="RFC8132">
          <front>
            <title>PATCH and FETCH Methods for the Constrained Application Protocol (CoAP)</title>
            <author initials="P." surname="van der Stok" fullname="P. van der Stok">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="C." surname="Bormann" fullname="C. Bormann">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Sehgal" fullname="A. Sehgal">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="April"/>
            <abstract>
              <t>The methods defined in RFC 7252 for the Constrained Application Protocol (CoAP) only allow access to a complete resource, not to parts of a resource.  In case of resources with larger or complex data, or in situations where resource continuity is required, replacing or requesting the whole resource is undesirable.  Several applications using CoAP need to access parts of the resources.</t>
              <t>This specification defines the new CoAP methods, FETCH, PATCH, and iPATCH, which are used to access and update parts of a resource.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8132"/>
          <seriesInfo name="DOI" value="10.17487/RFC8132"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="May"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <reference anchor="RFC8259" target="https://www.rfc-editor.org/info/rfc8259" quoteTitle="true" derivedAnchor="RFC8259">
          <front>
            <title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
            <author initials="T." surname="Bray" fullname="T. Bray" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="December"/>
            <abstract>
              <t>JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format.  It was derived from the ECMAScript Programming Language Standard.  JSON defines a small set of formatting rules for the portable representation of structured data.</t>
              <t>This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="90"/>
          <seriesInfo name="RFC" value="8259"/>
          <seriesInfo name="DOI" value="10.17487/RFC8259"/>
        </reference>
        <reference anchor="RFC8428" target="https://www.rfc-editor.org/info/rfc8428" quoteTitle="true" derivedAnchor="RFC8428">
          <front>
            <title>Sensor Measurement Lists (SenML)</title>
            <author initials="C." surname="Jennings" fullname="C. Jennings">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="Z." surname="Shelby" fullname="Z. Shelby">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Arkko" fullname="J. Arkko">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Keranen" fullname="A. Keranen">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="C." surname="Bormann" fullname="C. Bormann">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2018" month="August"/>
            <abstract>
              <t>This specification defines a format for representing simple sensor measurements and device parameters in Sensor Measurement Lists (SenML).  Representations are defined in JavaScript Object Notation (JSON), Concise Binary Object Representation (CBOR), Extensible Markup Language (XML), and Efficient XML Interchange (EXI), which share the common SenML data model.  A simple sensor, such as a temperature sensor, could use one of these media types in protocols such as HTTP or the Constrained Application Protocol (CoAP) to transport the measurements of the sensor or to be configured.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8428"/>
          <seriesInfo name="DOI" value="10.17487/RFC8428"/>
        </reference>
      </references>
      <references pn="section-8.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="IPSO" target="http://www.openmobilealliance.org/tech/profiles/lwm2m/3311.xml" quoteTitle="true" derivedAnchor="IPSO">
          <front>
            <title>IPSO Light Control Smart Object</title>
            <author>
              <organization showOnFrontPage="true">IPSO</organization>
            </author>
            <date year="2019"/>
          </front>
        </reference>
      </references>
    </references>
    <section anchor="acks" numbered="false" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-acknowledgements">Acknowledgements</name>
      <t pn="section-appendix.a-1">The use of the FETCH and (i)PATCH methods with SenML was first
      introduced by the OMA SpecWorks Lightweight Machine to Machine (LwM2M)
      v1.1 specification. This document generalizes the use to any SenML
      representation. The authors would like to thank <contact fullname="Carsten Bormann"/>, <contact fullname="Christian Amsüss"/>,
      <contact fullname="Jaime Jiménez"/>, <contact fullname="Klaus Hartke"/>,
      <contact fullname="Michael Richardson"/>, and other participants from
      the IETF CoRE and OMA SpecWorks DMSE working groups who have contributed
      ideas and reviews.</t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-authors-addresses">Authors' Addresses</name>
      <author initials="A." surname="Keränen" fullname="Ari Keränen">
        <organization showOnFrontPage="true">Ericsson</organization>
        <address>
          <postal>
            <street/>
            <city>Jorvas</city>
            <code>02420</code>
            <country>Finland</country>
          </postal>
          <email>ari.keranen@ericsson.com</email>
        </address>
      </author>
      <author initials="M." surname="Mohajer" fullname="Mojan Mohajer">
        <organization showOnFrontPage="true"/>
        <address>
          <email>mojanm@hotmail.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
