draft-ietf-core-interfaces-05.txt   draft-ietf-core-interfaces-06.txt 
CoRE Z. Shelby CoRE Working Group Z. Shelby
Internet-Draft ARM Internet-Draft ARM
Intended status: Informational M. Vial Intended status: Informational Z. Vial
Expires: January 6, 2017 Schneider-Electric Expires: May 1, 2017 Schneider-Electric
M. Koster M. Koster
SmartThings SmartThings
C. Groves C. Groves
Huawei Huawei
July 5, 2016 October 28, 2016
Reusable Interface Definitions for Constrained RESTful Environments Reusable Interface Definitions for Constrained RESTful Environments
draft-ietf-core-interfaces-05 draft-ietf-core-interfaces-06
Abstract Abstract
This document defines a set of reusable REST resource design patterns This document defines a set of Constrained RESTful Environments
suitable for use in constrained environments, based on IETF CoRE (CoRE) Link Format Interface Descriptions [RFC6690] applicable for
standards for information representation and information exchange. use in constrained environments. These include the: Actuator,
Paramter, Read-only parameter, Sensor, Batch, Linked Batch and Link
Interface types for Sensors, Actuators, Parameters, and resource List interfaces.
Collections are defined using the "if" link attribute defined by CoRE
Link Format [RFC6690]. Clients may use the "if" attribute to
determine how to consume resources.
Editor's note: This version removes the observe notify functionality. The Batch, Linked Batch and Link List interfaces make use of resource
Further work is needed on this draft to collections. This document further describes how collections relate
to interfaces.
1 Focus the interfaces draft exclusively on interfaces and Many applications require a set of interface descriptions in order
collections, and make it clear that this is not the IETF provide the required functionality. This document defines the
officialy endorsed way to use REST. Build compatibility with OCF concept of function sets to specify this set of interfaces and
collections to the most reasonable extent, otherwise, try to fnid resources.
best practice guidance.
2 Tone down the formality of function set definition and remove the _Editor's note: The git repository for the draft is found at
perception that CoRE Interfaces defines REST function sets. https://github.com/core-wg/interfaces_
Instead, find some descriptive language that accomplishes the
same thing in RD, Pubsub, Interfaces, and other drafts that want
to define REST API profiles for mapping functions.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on May 1, 2017.
This Internet-Draft will expire on January 6, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the Copyright (c) 2016 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. Interface Types . . . . . . . . . . . . . . . . . . . . . . . 5 3. Collections . . . . . . . . . . . . . . . . . . . . . . . . . 5
4. Collections . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1. Introduction to Collections . . . . . . . . . . . . . . . 5
4.1. Introduction to Collections . . . . . . . . . . . . . . . 5 3.2. Use Cases for Collections . . . . . . . . . . . . . . . . 6
4.2. Use Cases for Collections . . . . . . . . . . . . . . . . 6 3.3. Content-Formats for Collections . . . . . . . . . . . . . 6
4.3. Content-Formats for Collections . . . . . . . . . . . . . 6 3.4. Links and Items in Collections . . . . . . . . . . . . . 7
4.4. Links and Items in Collections . . . . . . . . . . . . . 7 3.5. Queries on Collections . . . . . . . . . . . . . . . . . 8
4.5. Queries on Collections . . . . . . . . . . . . . . . . . 8 3.6. Observing Collections . . . . . . . . . . . . . . . . . . 8
4.6. Observing Collections . . . . . . . . . . . . . . . . . . 8 3.7. Collection Types . . . . . . . . . . . . . . . . . . . . 9
4.7. Collection Types . . . . . . . . . . . . . . . . . . . . 8 4. Interface Descriptions . . . . . . . . . . . . . . . . . . . 9
5. Interface Descriptions . . . . . . . . . . . . . . . . . . . 9 4.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 11
5.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 10 4.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 12
5.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 11 4.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 14
5.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 13 4.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 14
5.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 13 4.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 14
5.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 14 5. Function Sets and Profiles . . . . . . . . . . . . . . . . . 15
5.8. Future Interfaces . . . . . . . . . . . . . . . . . . . . 14 5.1. Defining a Function Set . . . . . . . . . . . . . . . . . 16
6. Function Sets and Profiles . . . . . . . . . . . . . . . . . 14 5.1.1. Path template . . . . . . . . . . . . . . . . . . . . 16
6.1. Defining a Function Set . . . . . . . . . . . . . . . . . 15 5.1.2. Resource Type . . . . . . . . . . . . . . . . . . . . 16
6.1.1. Path template . . . . . . . . . . . . . . . . . . . . 15 5.1.3. Interface Description . . . . . . . . . . . . . . . . 17
6.1.2. Resource Type . . . . . . . . . . . . . . . . . . . . 15 5.1.4. Data type . . . . . . . . . . . . . . . . . . . . . . 17
6.1.3. Interface Description . . . . . . . . . . . . . . . . 16 5.2. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.4. Data type . . . . . . . . . . . . . . . . . . . . . . 16 5.3. Versioning . . . . . . . . . . . . . . . . . . . . . . . 17
6.2. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 16 6. Security Considerations . . . . . . . . . . . . . . . . . . . 18
6.3. Versioning . . . . . . . . . . . . . . . . . . . . . . . 17 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18
7. Security Considerations . . . . . . . . . . . . . . . . . . . 17 7.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 18
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 7.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 18
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 17 7.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 18
10. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 17 7.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 19
11. References . . . . . . . . . . . . . . . . . . . . . . . . . 19 7.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 19
11.1. Normative References . . . . . . . . . . . . . . . . . . 19 7.6. Read-only parameter . . . . . . . . . . . . . . . . . . . 19
11.2. Informative References . . . . . . . . . . . . . . . . . 20 7.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 19
Appendix A. Profile example . . . . . . . . . . . . . . . . . . 20 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 20
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21 9. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 20
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 22
10.1. Normative References . . . . . . . . . . . . . . . . . . 23
10.2. Informative References . . . . . . . . . . . . . . . . . 23
Appendix A. Current Usage of Interfaces and Function Sets . . . 24
A.1. Constrained RESTful Environments (CoRE) Link Format
(IETF) . . . . . . . . . . . . . . . . . . . . . . . . . 25
A.2. CoRE Resource Directory (IETF) . . . . . . . . . . . . . 25
A.3. Open Connectivity Foundation (OCF) . . . . . . . . . . . 25
A.4. oneM2M . . . . . . . . . . . . . . . . . . . . . . . . . 26
A.5. OMA LWM2M . . . . . . . . . . . . . . . . . . . . . . . . 26
Appendix B. Profile example . . . . . . . . . . . . . . . . . . 27
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28
1. Introduction 1. Introduction
IETF Standards for machine to machine communication in constrained IETF Standards for machine to machine communication in constrained
environments describe a REST protocol and a set of related environments describe a REST protocol and a set of related
information standards that may be used to represent machine data and information standards that may be used to represent machine data and
machine metadata in REST interfaces. CoRE Link-format is a standard machine metadata in REST interfaces. CoRE Link-format is a standard
for doing Web Linking [RFC5988] in constrained environments. SenML for doing Web Linking [RFC5988] in constrained environments. SenML
[I-D.ietf-core-senml] is a simple data model and representation [I-D.ietf-core-senml] is a simple data model and representation
format for composite and complex structured resources. CoRE Link- format for composite and complex structured resources. CoRE Link-
Format and SenML can be used by CoAP [RFC7252] or HTTP servers. Format and SenML can be used by CoAP [RFC7252] or HTTP servers.
The discovery of resources offered by a constrained server is very The discovery of resources offered by a constrained server is very
important in machine-to-machine applications where there are no important in machine-to-machine applications where there are no
humans in the loop. Machine application clients must be able to humans in the loop. Machine application clients must be able to
adapt to different resource organizations without advance knowledge adapt to different resource organizations without advance knowledge
of the specific data structures hosted by each connected thing. The of the specific data structures hosted by each connected thing. The
use of Web Linking for the description and discovery of resources use of Web Linking for the description and discovery of resources
hosted by constrained web servers is specified by CoRE Link Format hosted by constrained web servers is specified by CoRE Link Format
[RFC6690]. CoRE Link Format additionally defines a link attribute [RFC6690]. CoRE Link Format additionally defines a link attribute
for Interface Type ("if") that can be used to describe the REST for interface description ("if") that can be used to describe the
interface of a resource, and may include a link to a description REST interface of a resource, and may include a link to a description
document. document.
This document defines a set of Link Format compatible Interface Types This document defines a set of Link Format interface descriptions for
for some common design patterns that enable the server side some common design patterns that enable the server side composition
composition and organization, and client side discovery and and organization, and client side discovery and consumption, of
consumption, of machine resources using Web Linking. An Interface machine resources using Web Linking. A client discovering the "if"
Type may describe a resource in terms of it's associated content
formats, data types, URI templates, REST methods, parameters, and
responses. Basic interface types are defined for sensors, actuators,
and properties. A set of collection types is defined for organizing
resources for discovery, and for various forms of bulk interaction
with resource sets using typed embedding links.
Interface Types may be used in the composition of Function Sets and
Profiles. Function Sets and Profiles are described and an example is
given of a sensor and actuator device profile using Function Sets
composed from the Interface Types described in this document.
This document describes a set of Interface Types which are referenced
by the "if" link attribute and used to implement reusable design
patterns and functional abstractions. A client discovering the "if"
link attribute will be able to consume resources based on its link attribute will be able to consume resources based on its
knowledge of the expected interface types. In this sense the knowledge of the expected interface types. In this sense the
Interface Type acts in a similar way as a Content-Format, but as a Interface Type acts in a similar way as a Content-Format, but as a
selector for a high level functional abstraction. selector for a high level functional abstraction.
An interface description describes a resource in terms of it's
associated content formats, data types, URI templates, REST methods,
parameters, and responses. Basic interface descriptions are defined
for sensors, actuators, and properties.
A set of collection types is defined for organizing resources for
discovery, and for various forms of bulk interaction with resource
sets using typed embedding links.
Interface descriptions may be used in the composition of Function
Sets and Profiles. Function Sets and Profiles are described and an
example is given of a sensor and actuator device profile using
Function Sets composed from the interface descriptions described in
this document.
This document first defines the concept of collection interface
descriptions. It then defines a number of generic interface
descriptions that may be used in contrained environments. Several of
these interface descriptions utilise collections. The interface
descriptions are then used by the function sets.
Whilst this document assumes the use of CoAP [RFC7252], the REST
interfaces described can also be realized using HTTP [RFC7230].
2. Terminology 2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
document are to be interpreted as described in [RFC2119]. "OPTIONAL" in this document are to be interpreted as described in
[RFC2119].
This specification requires readers to be familiar with all the terms
and concepts that are discussed in [RFC5988] and [RFC6690]. This
specification makes use of the following additional terminology:
Interface Type: A resource attribute which describes the interface This document requires readers to be familiar with all the terms and
exposed by the resource in terms of content formats, REST methods, concepts that are discussed in [RFC5988] and [RFC6690]. This
parameters, and other related characteristics. document makes use of the following additional terminology:
Collection: A resource which contains set of related resources, Device: An IP smart object running a web server that hosts a group
referenced by a list of links and optionally consisting of of Function Set instances from a profile.
subresources.
Resource Discovery: The process allowing a web client to identify Function Set: A group of well-known REST resources that provides a
resources being hosted on a web server. particular service.
Gradual Reveal: A REST design where resources are discovered Gradual Reveal: A REST design where resources are discovered
progressively using Web Linking. progressively using Web Linking.
Function Set: A group of well-known REST resources that provides a Interface Description: The Interface Description describes the
particular service. generic REST interface to interact with a resource or a set of
resources. Its use is described via the Interface Description
'if' attribute which is an opaque string used to provide a name or
URI indicating a specific interface definition used to interact
with the target resource. One can think of this as describing
verbs usable on a resource.
Profile: A group of well-known Function Sets defined by a Profile: A group of well-known Function Sets defined by a
specification. specification.
Device: An IP smart object running a web server that hosts a group Resource Discovery: The process allowing a web client to identify
of Function Set instances from a profile. resources being hosted on a web server.
Service Discovery: The process making it possible for a web client Service Discovery: The process making it possible for a web client
to automatically detect devices and Function Sets offered by these to automatically detect devices and Function Sets offered by these
devices on a CoRE network. devices on a CoRE network.
3. Interface Types 3. Collections
An Interface Type definition may describe a resource in terms of it's 3.1. Introduction to Collections
associated content formats, data types, URI templates, REST methods,
parameters, and responses.
4. Collections A Collection is a resource which represents one or more related
resources. [RFC6573] describes the "item" and "collection" Link
Relation. "item" link relation identifies a member of collection.
"collection" indicates the collection that an item is a member of.
For example: A collection might be a resource representing catalog of
products, an item is a resource related to an individual product.
4.1. Introduction to Collections Section 1.2.2/[RFC6690] also describes resource collections.
A Collection is a resource which represents one or more related This document uses the concept of "collection" and applies it to
resources. Within this document, a collection refers to a collection interface descriptions. A collection interface description consists
with characteristics defined in this document. A Collection of a set of links and a set of items pointed to by the links which
Interface Type consists of a set of links and a set of items pointed may be sub-resources of the collection resource. The collection
to by the links which may be sub-resources of the collection interface descriptions described in this document are Link List,
resource. The collection types described in this document are Link Batch and Linked Batch.
List, Batch and Linked Batch.
The links in a collection are represented in CoRE Link-Format The links in a collection are represented in CoRE Link-Format
Content-Formats including JSON and CBOR variants, and the items in Content-Formats including JSON and CBOR variants, and the items in
the collection may be represented by senml, including JSON and CBOR the collection may be represented by senml, including JSON and CBOR
variants. In general, a collection may support items of any variants. In general, a collection may support items of any
available Content-Format. available Content-Format.
A particular resource item may be a member of more than one A particular resource item may be a member of more than one
collection at a time by being linked to, but may only be a collection at a time by being linked to, but may only be a
subresource of one collection. subresource of one collection.
skipping to change at page 6, line 5 skipping to change at page 6, line 21
image tag (link) causing the image to display inline in a browser image tag (link) causing the image to display inline in a browser
window. Resources pointed to by embedded links in collections may be window. Resources pointed to by embedded links in collections may be
interacted with using bulk operations on the collection resource. interacted with using bulk operations on the collection resource.
For example, performing a GET on a collection resource may return a For example, performing a GET on a collection resource may return a
single representation containing all of the linked resources. single representation containing all of the linked resources.
Links in collections may be selected for processing by a particular Links in collections may be selected for processing by a particular
request by using Query Filtering as described in CoRE Link-Format request by using Query Filtering as described in CoRE Link-Format
[RFC6690]. [RFC6690].
4.2. Use Cases for Collections 3.2. Use Cases for Collections
Collections may be used to provide gradual reveal of resources on an Collections may be used to provide gradual reveal of resources on an
endpoint. There may be a small set of links at the .well-known/core endpoint. There may be a small set of links at the .well-known/core
location, which may in turn point to other collections of resources location, which may in turn point to other collections of resources
that represent device information, device configuration, device that represent device information, device configuration, device
management, and various functional clusters of resources on the management, and various functional clusters of resources on the
device. device.
A collection may provide resource encapsulation, where link embedding A collection may provide resource encapsulation, where link embedding
may be used to provide a single resource with which a client may may be used to provide a single resource with which a client may
skipping to change at page 6, line 29 skipping to change at page 6, line 45
resources which can be read as a single senml data object. resources which can be read as a single senml data object.
A collection may be used to group a set of like resources for bulk A collection may be used to group a set of like resources for bulk
state update or actuation. For example, the brightness control state update or actuation. For example, the brightness control
resources of a number of luminaries may be grouped by linking to them resources of a number of luminaries may be grouped by linking to them
in a collection. The collection type may support receiving a single in a collection. The collection type may support receiving a single
update form a client and sending that update to each resource item in update form a client and sending that update to each resource item in
the collection. the collection.
Items may be sub-resources of the collection resource. This enables Items may be sub-resources of the collection resource. This enables
updates to to multiple items in the collection to be processed updates to multiple items in the collection to be processed together
together within the context of the collection resource. within the context of the collection resource.
4.3. Content-Formats for Collections 3.3. Content-Formats for Collections
The collection interfaces by default use CoRE Link-Format for the The collection interfaces by default use CoRE Link-Format for the
link representations and SenML or text/plain for representations of link representations and SenML or text/plain for representations of
items. The examples given are for collections that expose resources items. The examples given are for collections that expose resources
and links in these formats. In addition, a new "collection" Content- and links in these formats. In addition, a new "collection" Content-
Format is defined based on the SenML framework which represents both Format is defined based on the SenML framework which represents both
links and items in the collection. links and items in the collection.
The choice of whether to return a representation of the links or of The choice of whether to return a representation of the links or of
the items or of the collection format is determined by the accepts the items or of the collection format is determined by the accepts
skipping to change at page 7, line 4 skipping to change at page 7, line 19
the items or of the collection format is determined by the accepts the items or of the collection format is determined by the accepts
header option in the request. Likewise, the choice of updating link header option in the request. Likewise, the choice of updating link
metadata or item data or the collection resource itself is determined metadata or item data or the collection resource itself is determined
by the Content-Format option in the header of the update request by the Content-Format option in the header of the update request
operation. operation.
The default Content-Formats for collection types described in this The default Content-Formats for collection types described in this
document are: document are:
Links: application/link-format, application/link-format+json Links: application/link-format, application/link-format+json
Items: application/senml+json, text/plain Items: application/senml+json, text/plain
4.4. Links and Items in Collections 3.4. Links and Items in Collections
Links use CoRE Link-Format representation by default and may point to Links use CoRE Link-Format representation by default and may point to
any resource reachable from the context of the collection. This any resource reachable from the context of the collection. This
includes absolute links and links that point to other network includes absolute links and links that point to other network
locations if the context of the collection allows. Links to sub- locations if the context of the collection allows. Links to sub-
resources in the collection MUST have a path-element starting with resources in the collection MUST have a path-element starting with
the resource name, as per RFC3986 [RFC3986]. Links to resources in the resource name, as per [RFC3986]. Links to resources in the
the global context MUST start with a root path identifier [RFC5988]. global context MUST start with a root path identifier [RFC5988].
Links to other collections are formed per RFC3986. Links to other collections are formed per [RFC3986].
Examples of links: Examples of links:
</sen/>;if="core.lb" : Link to the /sen/ collection describing it as </sen/>;if="core.lb"': Link to the /sen/ collection describing it as
a core.lb type collection (Linked Batch) a core.lb type collection (Linked Batch)
</sen/>;rel="grp" : Link to the /sen/ collection indicating that </sen/>;rel="grp"': Link to the /sen/ collection indicating that
/sen/ is a member of a group in the collection in which the link /sen/ is a member of a group in the collection in which the link
appears. appears.
<"/sen/temp">;rt="temperature" : An absolute link to the resource at <"/sen/temp">;rt="temperature"': An absolute link to the resource at
the path /sen/temp the path /sen/temp
<temp>;rt="temperature" : Link to the temp subresource of the <temp>;rt="temperature": Link to the temp subresource of the
collection in which this link appears. collection in which this link appears."
<temp>;anchor="/sen/" : A link to the temp subresource of the <temp>;anchor="/sen/": A link to the temp subresource of the
collection /sen/ which is assumed not to be a subresource of the collection /sen/ which is assumed not to be a subresource of the
collection in which the link appears ,but is expected to be collection in which the link appears ,but is expected to be
identified in the collection by resource name. identified in the collection by resource name.
Links in the collection MAY be Read, Updated, Added, or Removed using Links in the collection MAY be Read, Updated, Added, or Removed using
the CoRE Link-Format or JSON Merge-Patch Content-Formats on the the CoRE Link-Format or JSON Merge-Patch Content-Formats on the
collection resource. Reading links uses the GET method and returns collection resource. Reading links uses the GET method and returns
an array or list containing the link-values of all selected links. an array or list containing the link-values of all selected links.
Links may be added to the collection using POST or PATCH methods. Links may be added to the collection using POST or PATCH methods.
Updates to links MUST use the PATCH method and MAY use query Updates to links MUST use the PATCH method and MAY use query
filtering to select links for updating. The PATCH method on links filtering to select links for updating. The PATCH method on links
MUST use the JSON Merge-Patch Content-Format (application/merge- MUST use the JSON Merge-Patch Content-Format (application/merge-
patch+json) specified in RFC7396 [RFC7396]. patch+json) specified in [RFC7396].
Items in the collection SHOULD be represented using the SenML Items in the collection SHOULD be represented using the SenML
(application/senml+json) or plain text (text/plain) Content-Formats, (application/senml+json) or plain text (text/plain) Content-Formats,
depending on whether the representation is of a single data point or depending on whether the representation is of a single data point or
multiple data points. Items MAY be represented using any supported multiple data points. Items MAY be represented using any supported
Content-Format. Content-Format.
Link Embedding enables the bulk processing of items in the collection Link Embedding enables the bulk processing of items in the collection
using a single operation targeting the collection resource. A subset using a single operation targeting the collection resource. A subset
of resources in the collection may be selected for operation using of resources in the collection may be selected for operation using
skipping to change at page 8, line 19 skipping to change at page 8, line 35
representation of all selected resources. Bulk item Update representation of all selected resources. Bulk item Update
operations using PUT or POST apply the payload document to all operations using PUT or POST apply the payload document to all
selected resource items in the collection, using either a Batch or selected resource items in the collection, using either a Batch or
Group update policy. A Batch update is performed by applying the Group update policy. A Batch update is performed by applying the
resource values in the payload document to all resources in the resource values in the payload document to all resources in the
collection that match any resource name in the payload document. collection that match any resource name in the payload document.
Group updates are performed by applying the payload document to each Group updates are performed by applying the payload document to each
item in the collection. Group updates are indicated by the link item in the collection. Group updates are indicated by the link
relation type rel="grp" in the link. relation type rel="grp" in the link.
4.5. Queries on Collections 3.5. Queries on Collections
Collections MAY support query filtering as defined in CoRE Link- Collections MAY support query filtering as defined in CoRE Link-
Format [RFC6690]. Operations targeting either the links or the items Format [RFC6690]. Operations targeting either the links or the items
MAY select a subset of links and items in the collection by using MAY select a subset of links and items in the collection by using
query filtering. The Content-Format specified in the request header query filtering. The Content-Format specified in the request header
selects whether links or items are targeted by the operation. selects whether links or items are targeted by the operation.
4.6. Observing Collections 3.6. Observing Collections
Resource Observation I-D.ietf-core-dynlink using CoAP [RFC7252] MAY Resource Observation via [I-D.ietf-core-dynlink] using CoAP [RFC7252]
be supported on items in a collection. A subset of the conditional MAY be supported on items in a collection. A subset of the
observe parameters MAY be specified to apply. In most cases pmin and conditional observe parameters MAY be specified to apply. In most
pmax are useful. Resource observation on a collection's items cases pmin and pmax are useful. Resource observation on a
resource MAY report any changes of resource state in any item in the collection's items resource MAY report any changes of resource state
collection. Observation Responses, or notifications, SHOULD provide in any item in the collection. Observation Responses, or
representations of the resources that have changed in SenML Content- notifications, SHOULD provide representations of the resources that
Format. Notifications MAY include multiple observations of a have changed in SenML Content-Format. Notifications MAY include
particular resource, with SenML time stamps indicating the multiple observations of a particular resource, with SenML time
observation times. stamps indicating the observation times.
4.7. Collection Types 3.7. Collection Types
There are three collection types defined in this document: There are three collection types defined in this document:
+-----------------+---------+--------------------+ +-----------------+---------+--------------------+
| Collection Type | if= | Content-Formats | | Collection Type | if= | Content-Format |
+-----------------+---------+--------------------+ +-----------------+---------+--------------------+
| Link List | core.ll | link-format | | Link List | core.ll | link-format |
| Batch | core.b | link-format, senml | | | | |
| Linked Batch | core.lb | link-format, senml | | Batch | core.b | link-format, senml |
| | | |
| Linked Batch | core.lb | link-format, senml |
+-----------------+---------+--------------------+ +-----------------+---------+--------------------+
Each collection type MAY support a subset of the methods and Table 1: Collection Type Summary
functions described above. For the first three collection types, the
methods and functions are defined in the corresponding Interface
Description.
5. Interface Descriptions The interface description defined in this document describes the
methods and functions that may be applied to the collections.
4. Interface Descriptions
This section defines REST interfaces for Link List, Batch, Sensor, This section defines REST interfaces for Link List, Batch, Sensor,
Parameter and Actuator resources. Variants such as Linked Batch or Parameter and Actuator resources. Variants such as Linked Batch or
Read-Only Parameter are also presented. Each type is described along Read-Only Parameter are also presented. Each type is described along
with its Interface Description attribute value and valid methods. with its Interface Description attribute value and valid methods.
These are defined for each interface in the table below. These These are defined for each interface in the table below. These
interfaces can support plain text and/or SenML Media types. interfaces can support plain text and/or SenML Media types.
The if= column defines the Interface Description (if=) attribute The if= column defines the Interface Description (if=) attribute
value to be used in the CoRE Link Format for a resource conforming to value to be used in the CoRE Link Format for a resource conforming to
that interface. When this value appears in the if= attribute of a that interface. When this value appears in the if= attribute of a
link, the resource MUST support the corresponding REST interface link, the resource MUST support the corresponding REST interface
described in this section. The resource MAY support additional described in this section. The resource MAY support additional
functionality, which is out of scope for this specification. functionality, which is out of scope for this document. Although
Although these interface descriptions are intended to be used with these interface descriptions are intended to be used with the CoRE
the CoRE Link Format, they are applicable for use in any REST Link Format, they are applicable for use in any REST interface
interface definition. definition.
The Methods column defines the methods supported by that interface, The Methods column defines the methods supported by that interface,
which are described in more detail below. which are described in more detail below.
+-----------------+---------+------------------+--------------------+ +--------------+---------+-----------------+--------------------+
| Interface | if= | Methods | Content-Formats | | Interface | if= | Methods | Content-Formats |
+-----------------+---------+------------------+--------------------+ +--------------+---------+-----------------+--------------------+
| Link List | core.ll | GET | link-format | | Link List | core.ll | GET | link-format |
| Batch | core.b | GET, PUT, POST | link-format, senml | | | | | |
| Linked Batch | core.lb | GET, PUT, POST, | link-format, senml | | Batch | core.b | GET, PUT, POST | link-format, senml |
| | | DELETE | | | | | | |
| Sensor | core.s | GET | link-format, | | Linked Batch | core.lb | GET, PUT, POST, | link-format, senml |
| | | | text/plain | | | | | |
| Parameter | core.p | GET, PUT | link-format, | | | | DELETE | |
| | | | text/plain | | | | | |
| Read-only | core.rp | GET | link-format, | | Sensor | core.s | GET | link-format, |
| Parameter | | | text/plain | | | | | |
| Actuator | core.a | GET, PUT, POST | link-format, | | | | | text/plain |
| | | | text/plain | | | | | |
+-----------------+---------+------------------+--------------------+ | Parameter | core.p | GET, PUT | link-format, |
| | | | |
| | | | text/plain |
| | | | |
| Read-only | core.rp | GET | link-format, |
| | | | |
| Parameter | | | text/plain |
| | | | |
| Actuator | core.a | GET, PUT, POST | link-format, |
| | | | |
| | | | text/plain |
+--------------+---------+-----------------+--------------------+
Table 2: Interface Description Summary
The following is an example of links in the CoRE Link Format using The following is an example of links in the CoRE Link Format using
these interface descriptions. The resource hierarchy is based on a these interface descriptions. The resource hierarchy is based on a
simple profile defined in Appendix A. These links are used in the simple profile defined in Appendix B. These links are used in the
subsequent examples below. subsequent examples below.
Req: GET /.well-known/core Req: GET /.well-known/core
Res: 2.05 Content (application/link-format) Res: 2.05 Content (application/link-format)
</s/>;rt="simple.sen";if="core.b", </s/>;rt="simple.sen";if="core.b",
</s/lt>;rt="simple.sen.lt";if="core.s", </s/lt>;rt="simple.sen.lt";if="core.s",
</s/tmp>;rt="simple.sen.tmp";if="core.s";obs, </s/tmp>;rt="simple.sen.tmp";if="core.s";obs,
</s/hum>;rt="simple.sen.hum";if="core.s", </s/hum>;rt="simple.sen.hum";if="core.s",
</a/>;rt="simple.act";if="core.b", </a/>;rt="simple.act";if="core.b",
</a/1/led>;rt="simple.act.led";if="core.a", </a/1/led>;rt="simple.act.led";if="core.a",
</a/2/led>;rt="simple.act.led";if="core.a", </a/2/led>;rt="simple.act.led";if="core.a",
</d/>;rt="simple.dev";if="core.ll", </d/>;rt="simple.dev";if="core.ll",
</l/>;if="core.lb", </l/>;if="core.lb",
5.1. Link List Figure 1: Binding Interface Example
4.1. Link List
The Link List interface is used to retrieve (GET) a list of resources The Link List interface is used to retrieve (GET) a list of resources
on a web server. The GET request SHOULD contain an Accept option on a web server. The GET request SHOULD contain an Accept option
with the application/link-format content format; however if the with the application/link-format content format; however if the
resource does not support any other form of GET methods the Accept resource does not support any other form of GET methods the Accept
option MAY be elided. The Accept option SHOULD only include the option MAY be elided. The Accept option SHOULD only include the
application/link-format content format. The request returns a list application/link-format content format.
of URI references with absolute paths to the resources as defined in
CoRE Link Format. This interface is typically used with a parent _Editor's note: This use of Accept is not very clear, should probably
resource to enumerate sub-resources but may be used to reference any explain this is due to this interface description being extended by
resource on a web server. Batch and Linked Batch later._
The request returns a list of URI references with absolute paths to
the resources as defined in CoRE Link Format. This interface is
typically used with a parent resource to enumerate sub-resources but
may be used to reference any resource on a web server.
Link List is the base interface to provide gradual reveal of Link List is the base interface to provide gradual reveal of
resources on a CoRE web server, hence the root resource of a Function resources on a CoRE web server, hence the root resource of a Function
Set SHOULD implement this interface or an extension of this Set SHOULD implement this interface or an extension of this
interface. interface.
The following example interacts with a Link List /d containing The following example interacts with a Link List /d containing
Parameter sub-resources /d/name, /d/model. Parameter sub-resources /d/name, /d/model.
Req: GET /d/ (Accept:application/link-format) Req: GET /d/ (Accept:application/link-format)
Res: 2.05 Content (application/link-format) Res: 2.05 Content (application/link-format)
</d/name>;rt="simple.dev.n";if="core.p", </d/name>;rt="simple.dev.n";if="core.p",
</d/model>;rt="simple.dev.mdl";if="core.rp" </d/model>;rt="simple.dev.mdl";if="core.rp"
5.2. Batch 4.2. Batch
The Batch interface is used to manipulate a collection of sub- The Batch interface is used to manipulate a collection of sub-
resources at the same time. The Batch interface type supports the resources at the same time. The Batch interface description supports
same methods as its sub-resources, and can be used to read (GET), the same methods as its sub-resources, and can be used to read (GET),
update (PUT) or apply (POST) the values of those sub-resource with a update (PUT) or apply (POST) the values of those sub-resource with a
single resource representation. The sub-resources of a Batch MAY be single resource representation. The sub-resources of a Batch MAY be
heterogeneous, a method used on the Batch only applies to sub- heterogeneous, a method used on the Batch only applies to sub-
resources that support it. For example Sensor interfaces do not resources that support it. For example Sensor interfaces do not
support PUT, and thus a PUT request to a Sensor member of that Batch support PUT, and thus a PUT request to a Sensor member of that Batch
would be ignored. A batch requires the use of SenML Media types in would be ignored. A batch requires the use of SenML Media types in
order to support multiple sub-resources. order to support multiple sub-resources.
In addition, The Batch interface is an extension of the Link List In addition, The Batch interface is an extension of the Link List
interface and in consequence MUST support the same methods. interface and in consequence MUST support the same methods.
_Editor's note: hould probably explain that this means doing a GET
with an Accept:application/link-format will return the sub-resource
links_
The following example interacts with a Batch /s/ with Sensor sub- The following example interacts with a Batch /s/ with Sensor sub-
resources /s/light, /s/temp and /s/humidity. resources /s/light, /s/temp and /s/humidity.
Req: GET /s/ Req: GET /s/
Res: 2.05 Content (application/senml+json) Res: 2.05 Content (application/senml+json)
{"e":[ {"e":[
{ "n": "light", "v": 123, "u": "lx" }, { "n": "light", "v": 123, "u": "lx" },
{ "n": "temp", "v": 27.2, "u": "degC" }, { "n": "temp", "v": 27.2, "u": "degC" },
{ "n": "humidity", "v": 80, "u": "%RH" }], { "n": "humidity", "v": 80, "u": "%RH" }],
} }
5.3. Linked Batch 4.3. Linked Batch
The Linked Batch interface is an extension of the Batch interface. The Linked Batch interface is an extension of the Batch interface.
Contrary to the basic Batch which is a collection statically defined Contrary to the basic Batch which is a collection statically defined
by the web server, a Linked Batch is dynamically controlled by a web by the web server, a Linked Batch is dynamically controlled by a web
client. A Linked Batch resource has no sub-resources. Instead the client. A Linked Batch resource has no sub-resources. Instead the
resources forming the batch are referenced using Web Linking resources forming the batch are referenced using Web Linking
[RFC5988] and the CoRE Link Format [RFC6690]. A request with a POST [RFC5988] and the CoRE Link Format [RFC6690]. A request with a POST
method and a content format of application/link-format simply appends method and a content format of application/link-format simply appends
new resource links to the collection. The links in the payload MUST new resource links to the collection. The links in the payload MUST
reference a resource on the web server with an absolute path. A reference a resource on the web server with an absolute path. A
skipping to change at page 12, line 35 skipping to change at page 13, line 35
Res: 2.05 Content (application/senml+json) Res: 2.05 Content (application/senml+json)
{"e":[ {"e":[
{ "n": "/s/light", "v": 123, "u": "lx" }, { "n": "/s/light", "v": 123, "u": "lx" },
{ "n": "/s/temp", "v": 27.2, "u": "degC" }, { "n": "/s/temp", "v": 27.2, "u": "degC" },
{ "n": "/s/humidity", "v": 80, "u": "%RH" }], { "n": "/s/humidity", "v": 80, "u": "%RH" }],
} }
Req: DELETE /l/ Req: DELETE /l/
Res: 2.02 Deleted Res: 2.02 Deleted
5.4. Sensor 4.4. Sensor
The Sensor interface allows the value of a sensor resource to be read The Sensor interface allows the value of a sensor resource to be read
(GET). The Media type of the resource can be either plain text or (GET). The Media type of the resource can be either plain text or
SenML. Plain text MAY be used for a single measurement that does not SenML. Plain text MAY be used for a single measurement that does not
require meta-data. For a measurement with meta-data such as a unit require meta-data. For a measurement with meta-data such as a unit
or time stamp, SenML SHOULD be used. A resource with this interface or time stamp, SenML SHOULD be used. A resource with this interface
MAY use SenML to return multiple measurements in the same MAY use SenML to return multiple measurements in the same
representation, for example a list of recent measurements. representation, for example a list of recent measurements.
The following are examples of Sensor interface requests in both text/ The following are examples of Sensor interface requests in both text/
skipping to change at page 13, line 15 skipping to change at page 14, line 15
Req: GET /s/humidity (Accept: text/plain) Req: GET /s/humidity (Accept: text/plain)
Res: 2.05 Content (text/plain) Res: 2.05 Content (text/plain)
80 80
Req: GET /s/humidity (Accept: application/senml+json) Req: GET /s/humidity (Accept: application/senml+json)
Res: 2.05 Content (application/senml+json) Res: 2.05 Content (application/senml+json)
{"e":[ {"e":[
{ "n": "humidity", "v": 80, "u": "%RH" }], { "n": "humidity", "v": 80, "u": "%RH" }],
} }
5.5. Parameter 4.5. Parameter
The Parameter interface allows configurable parameters and other The Parameter interface allows configurable parameters and other
information to be modeled as a resource. The value of the parameter information to be modeled as a resource. The value of the parameter
can be read (GET) or update (PUT). Plain text or SenML Media types can be read (GET) or update (PUT). Plain text or SenML Media types
MAY be returned from this type of interface. MAY be returned from this type of interface.
The following example shows request for reading and updating a The following example shows request for reading and updating a
parameter. parameter.
Req: GET /d/name Req: GET /d/name
Res: 2.05 Content (text/plain) Res: 2.05 Content (text/plain)
node5 node5
Req: PUT /d/name (text/plain) Req: PUT /d/name (text/plain)
outdoor outdoor
Res: 2.04 Changed Res: 2.04 Changed
5.6. Read-only Parameter 4.6. Read-only Parameter
The Read-only Parameter interface allows configuration parameters to The Read-only Parameter interface allows configuration parameters to
be read (GET) but not updated. Plain text or SenML Media types MAY be read (GET) but not updated. Plain text or SenML Media types MAY
be returned from this type of interface. be returned from this type of interface.
The following example shows request for reading such a parameter. The following example shows request for reading such a parameter.
Req: GET /d/model Req: GET /d/model
Res: 2.05 Content (text/plain) Res: 2.05 Content (text/plain)
SuperNode200 SuperNode200
5.7. Actuator 4.7. Actuator
The Actuator interface is used by resources that model different The Actuator interface is used by resources that model different
kinds of actuators (changing its value has an effect on its kinds of actuators (changing its value has an effect on its
environment). Examples of actuators include for example LEDs, environment). Examples of actuators include for example LEDs,
relays, motor controllers and light dimmers. The current value of relays, motor controllers and light dimmers. The current value of
the actuator can be read (GET) or the actuator value can be updated the actuator can be read (GET) or the actuator value can be updated
(PUT). In addition, this interface allows the use of POST to change (PUT). In addition, this interface allows the use of POST to change
the state of an actuator, for example to toggle between its possible the state of an actuator, for example to toggle between its possible
values. Plain text or SenML Media types MAY be returned from this values. Plain text or SenML Media types MAY be returned from this
type of interface. A resource with this interface MAY use SenML to type of interface. A resource with this interface MAY use SenML to
include multiple measurements in the same representation, for example include multiple measurements in the same representation, for example
a list of recent actuator values or a list of values to updated. a list of recent actuator values or a list of values to updated.
The following example shows requests for reading, setting and The following example shows requests for reading, setting and
toggling an actuator (turning on a led). toggling an actuator (turning on a LED).
Req: GET /a/1/led Req: GET /a/1/led
Res: 2.05 Content (text/plain) Res: 2.05 Content (text/plain)
0 0
Req: PUT /a/1/led (text/plain) Req: PUT /a/1/led (text/plain)
1 1
Res: 2.04 Changed Res: 2.04 Changed
Req: POST /a/1/led (text/plain) Req: POST /a/1/led (text/plain)
Res: 2.04 Changed Res: 2.04 Changed
Req: GET /a/1/led Req: GET /a/1/led
Res: 2.05 Content (text/plain) Res: 2.05 Content (text/plain)
0 0
5.8. Future Interfaces 5. Function Sets and Profiles
It is expected that further interface descriptions will be defined in
this and other specifications.
6. Function Sets and Profiles
This section defines how a set of REST resources can be created This section defines how a set of REST resources can be created
called a function set. A Function Set is similar to a function block called a function set. A Function Set is similar to a function block
in the sense that it consists of input, output and parameter in the sense that it consists of input, output and parameter
resources and contains internal logic. A Function Set can have a resources and contains internal logic. A Function Set can have a
subset of mandatory inputs, outputs and parameters to provide minimum subset of mandatory inputs, outputs and parameters to provide minimum
interoperability. It can also be extended with manufacturer/user- interoperability. It can also be extended with manufacturer/user-
specific resources. A device is composed of one or more Function Set specific resources. A device is composed of one or more Function Set
instances. instances.
An example of function sets can be found from the CoRE Resource An example of function sets can be found from the CoRE Resource
Directory specification that defines REST interfaces for Directory specification that defines REST interfaces for
registration, group and lookup [I-D.ietf-core-resource-directory]. registration, group and lookup [I-D.ietf-core-resource-directory].
The OMA Lightweight M2M standard [REF] also defines a function set
structure called an Objects that use integer path, instance and
resource URI segments. OMA Objects can be defined and then
registered with an OMA maintained registry [REF]. This section is
simply meant as a guideline for the definition of other such REST
interfaces, either custom or part of other specifications.
6.1. Defining a Function Set The OMA Lightweight M2M standard [OMA-TS-LWM2M] also defines a
function set structure called an Objects that use integer path,
instance and resource URI segments. OMA Objects can be defined and
then registered with an OMA maintained registry [OMA-TS-LWM2M]. This
section is simply meant as a guideline for the definition of other
such REST interfaces, either custom or part of other specifications.
5.1. Defining a Function Set
In a Function Set, types of resources are defined. Each type In a Function Set, types of resources are defined. Each type
includes a human readable name, a path template, a Resource Type for includes a human readable name, a path template, a Resource Type for
discovery, the Interface Definition and the data type and allowed discovery, the Interface Definition and the data type and allowed
values. A Function Set definition may also include a field values. A Function Set definition may also include a field
indicating if a sub-resource is mandatory or optional. indicating if a sub-resource is mandatory or optional.
6.1.1. Path template 5.1.1. Path template
A Function Set is a container resource under which its sub-resources A Function Set is a container resource under which its sub-resources
are organized. The profile defines the path to each resource of a are organized. The profile defines the path to each resource of a
Function Set in a path template. The template can contain either Function Set in a path template. The template can contain either
relative paths or absolute paths depending on the profile needs. An relative paths or absolute paths depending on the profile needs. An
absolute Function Set should be located at its recommended root path absolute Function Set should be located at its recommended root path
on a web server, however it can be located under an alternative path on a web server, however it can be located under an alternative path
if necessary (for example multi-purpose devices, gateways etc.). A if necessary (for example multi-purpose devices, gateways etc.). A
relative Function Set can be instantiated as many times as needed on relative Function Set can be instantiated as many times as needed on
a web server with an arbitrary root path. However some Function Sets a web server with an arbitrary root path. However some Function Sets
(e.g. device description) only make sense as singletons. (e.g. device description) only make sense as singletons.
The path template includes a possible index {#} parameter, and The path template includes a possible index {#} parameter, and
possible fixed path segments. The index {#} allows for multiple possible fixed path segments. The index {#} allows for multiple
instances of this type of resource, and can be any string. The root instances of this type of resource, and can be any string. The root
path and the indexes are the only variable elements in a path path and the indexes are the only variable elements in a path
template. All other path segments should be fixed. template. All other path segments should be fixed.
6.1.2. Resource Type 5.1.2. Resource Type
Each root resource of a Function Set is assigned a Resource Type Each root resource of a Function Set is assigned a Resource Type
parameter, therefore making it possible to discover it. Each sub- parameter, therefore making it possible to discover it. Each sub-
resource of a Function Set is also assigned a Resource Type resource of a Function Set is also assigned a Resource Type
parameter. This Resource Type is used for resource discovery and is parameter. This Resource Type is used for resource discovery and is
usually necessary to discover optional resources supported on a usually necessary to discover optional resources supported on a
specific device. The Resource Type of a Function Set may also be specific device. The Resource Type of a Function Set may also be
used for service discovery and can be exported to DNS-SD [RFC6763] used for service discovery and can be exported to DNS-SD [RFC6763]
for example. for example.
The Resource Type parameter defines the value that should be included The Resource Type parameter defines the value that should be included
in the rt= field of the CoRE Link Format when describing a link to in the rt= field of the CoRE Link Format when describing a link to
this resource. The value SHOULD be in the form "namespace.type" for this resource. The value SHOULD be in the form "namespace.type" for
root resources and "namespace.type.subtype" for sub-resources. This root resources and "namespace.type.subtype" for sub-resources. This
naming convention facilitates resource type filtering with the naming convention facilitates resource type filtering with the
/.well-known/core resource. However a profile could allow mixing in /.well-known/core resource. However a profile could allow mixing in
foreign namespace references within a Function Set to import external foreign namespace references within a Function Set to import external
references from other object models (e.g. SenML and UCUM). references from other object models (e.g. SenML and UCUM).
6.1.3. Interface Description 5.1.3. Interface Description
The Interface Description parameter defines the REST interface for The Interface Description parameter defines the REST interface for
that type of resource. Several base interfaces are defined in that type of resource. Several base interfaces are defined in
Section 5 of this document. For a given profile, the Interface Section 4 of this document. For a given profile, the Interface
Description may be inferred from the Resource Type. In that case the Description may be inferred from the Resource Type. In that case the
Interface Description MAY be elided from link descriptions of Interface Description MAY be elided from link descriptions of
resource types defined in the profile, but should be included for resource types defined in the profile, but should be included for
custom extensions to the profile. custom extensions to the profile.
The root resource of a Function Set should provide a list of links to The root resource of a Function Set should provide a list of links to
its sub-resources in order to offer gradual reveal of resources. The its sub-resources in order to offer gradual reveal of resources. The
CoRE Link List interface defined in Section 5.1 offers this CoRE Link List interface defined in Section 7.1 offers this
functionality so a root resource should support this interface or a functionality so a root resource should support this interface or a
derived interface like CoRE Batch (See Section 5.2). derived interface like CoRE Batch (See Section 7.2).
6.1.4. Data type 5.1.4. Data type
The Data Type field defines the type of value (and possible range) The Data Type field defines the type of value (and possible range)
that is returned in response to a GET for that resource or accepted that is returned in response to a GET for that resource or accepted
with a PUT. The interfaces defined in Section 5 make use of plain with a PUT. The interfaces defined in Section 4 make use of plain
text and SenML Media types for the actual format of this data. A text and SenML Media types for the actual format of this data. A
profile may restrict the list of supported content formats for the profile may restrict the list of supported content formats for the
CoRE interfaces or define new interfaces with new content types. CoRE interfaces or define new interfaces with new content types.
6.2. Discovery 5.2. Discovery
A device conforming to a profile SHOULD make its resources A device conforming to a profile SHOULD make its resources
discoverable by providing links to the resources on the path /.well- discoverable by providing links to the resources on the path /.well-
known/core as defined in [RFC6690]. All resources hosted on a device known/core as defined in [RFC6690]. All resources hosted on a device
SHOULD be discoverable either with a direct link in /.well-known/core SHOULD be discoverable either with a direct link in /.well-known/core
or by following successive links starting from /.well-known/core. or by following successive links starting from /.well-known/core.
The root path of a Function Set instance SHOULD be directly The root path of a Function Set instance SHOULD be directly
referenced in /.well-known/core in order to offer discovery at the referenced in /.well-known/core in order to offer discovery at the
first discovery stage. A device with more than 10 individual first discovery stage. A device with more than 10 individual
resources SHOULD only expose Function Set instances in /.well-known/ resources SHOULD only expose Function Set instances in /.well-known/
core to limit the size of this resource. core to limit the size of this resource.
In addition, a device MAY register its resources to a Resource In addition, a device MAY register its resources to a Resource
Directory using the registration interface defined in Directory using the registration interface defined in
[I-D.ietf-core-resource-directory] if such a directory is available. [I-D.ietf-core-resource-directory] if such a directory is available.
6.3. Versioning 5.3. Versioning
A profile should track Function Set changes to avoid incompatibility A profile should track Function Set changes to avoid incompatibility
issues. Evolutions in a Function Set SHOULD be backward compatible. issues. Evolutions in a Function Set SHOULD be backward compatible.
7. Security Considerations 6. Security Considerations
An implementation of a client needs to be prepared to deal with An implementation of a client needs to be prepared to deal with
responses to a request that differ from what is specified in this responses to a request that differ from what is specified in this
document. A server implementing what the client thinks is a resource document. A server implementing what the client thinks is a resource
with one of these interface descriptions could return malformed with one of these interface descriptions could return malformed
representations and response codes either by accident or maliciously. representations and response codes either by accident or maliciously.
A server sending maliciously malformed responses could attempt to A server sending maliciously malformed responses could attempt to
take advantage of a poorly implemented client for example to crash take advantage of a poorly implemented client for example to crash
the node or perform denial of service. the node or perform denial of service.
8. IANA Considerations 7. IANA Considerations
The interface description types defined require registration. This document registers the following CoRE Interface Description
(if=) Link Target Attribute Values.
The new link relations type "grp" requires registration. 7.1. Link List
9. Acknowledgments Attribute Value: core.ll
Description: The Link List interface is used to retrieve a list of
resources on a web server.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
7.2. Batch
Attribute Value: core.b
Description: The Batch interface is used to manipulate a collection
of sub-resources at the same time.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
7.3. Linked Batch
Attribute Value: core.lb
Description: The Linked Batch interface is an extension of the Batch
interface. Contrary to the basic Batch which is a collection
statically defined by the web server, a Linked Batch is
dynamically controlled by a web client.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
7.4. Sensor
Attribute Value: core.s
Description: The Sensor interface allows the value of a sensor
resource to be read.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
7.5. Parameter
Attribute Value: core.p
Description: The Parameter interface allows configurable parameters
and other information to be modeled as a resource. The value of
the parameter can be read or update.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
7.6. Read-only parameter
Attribute Value: core.rp
Description: The Read-only Parameter interface allows configuration
parameters to be read but not updated.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
7.7. Actuator
Attribute Value: core.a
Description: The Actuator interface is used by resources that model
different kinds of actuators (changing its value has an effect on
its environment). Examples of actuators include for example LEDs,
relays, motor controllers and light dimmers. The current value of
the actuator can be read or the actuator value can be updated. In
addition, this interface allows the use of POST to change the
state of an actuator, for example to toggle between its possible
values.
Reference: This document. Note to RFC Editor - please insert the
appropriate RFC reference.
Notes: None
8. Acknowledgements
Acknowledgement is given to colleagues from the SENSEI project who Acknowledgement is given to colleagues from the SENSEI project who
were critical in the initial development of the well-known REST were critical in the initial development of the well-known REST
interface concept, to members of the IPSO Alliance where further interface concept, to members of the IPSO Alliance where further
requirements for interface types have been discussed, and to Szymon requirements for interface descriptions have been discussed, and to
Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann who have Szymon Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann
provided useful discussion and input to the concepts in this who have provided useful discussion and input to the concepts in this
document. document.
10. Changelog 9. Changelog
Changes from -04 to -05 Changes from -05 to -06:
o Updated the abstract.
o Section 1: Updated introduction.
o Section 2: Alphabetised the order
o Section 2: Removed the collections definition in favour of the
complete definition in the collections section.
o Removed section 3 on interfaces in favour of an updated definition
in section 1.3.
o General: Changed interface type to interface description as that
is the term defined in RFC6690.
o Removed section on future interfaces.
o Section 8: Updated IANA considerations.
o Added Appendix A to discuss current state of the art wrt to
collections, function sets etc.
Changes from -04 to -05:
o Removed Link Bindings and Observe attributes. This functionality o Removed Link Bindings and Observe attributes. This functionality
is now contained in I-D.ietf-core-dynlink. is now contained in I-D.ietf-core-dynlink.
o Hypermedia collections have been removed. This is covered in a o Hypermedia collections have been removed. This is covered in a
new T2TRG draft. new T2TRG draft.
o The WADL description has been removed. o The WADL description has been removed.
o Fixed minor typos. o Fixed minor typos.
o Updated references. o Updated references.
Changes from -03 to -04 Changes from -03 to -04:
o Fixed tickets #385 and #386. o Fixed tickets #385 and #386.
o Changed abstract and into to better describe content. o Changed abstract and into to better describe content.
o Focus on Interface and not function set/profiles in intro. o Focus on Interface and not function set/profiles in intro.
o Changed references from draft-core-observe to RFC7641. o Changed references from draft-core-observe to RFC7641.
o Moved Function sets and Profiles to section after Interfaces. o Moved Function sets and Profiles to section after Interfaces.
o Moved Observe Attributes to the Link Binding section. o Moved Observe Attributes to the Link Binding section.
o Add a Collection section to describe the collection types. o Add a Collection section to describe the collection types.
o Add the Hypermedia Collection Interface Description. o Add the Hypermedia Collection Interface Description.
Changes from -02 to -03 Changes from -02 to -03:
o Added lt and gt to binding format section. o Added lt and gt to binding format section.
o Added pmin and pmax observe parameters to Observation Attributes. o Added pmin and pmax observe parameters to Observation Attributes.
o Changed the definition of lt and gt to limit crossing. o Changed the definition of lt and gt to limit crossing.
o Added definitions for getattr and setattr to WADL. o Added definitions for getattr and setattr to WADL.
o Added getattr and setattr to observable interfaces. o Added getattr and setattr to observable interfaces.
o Removed query parameters from Observe definition. o Removed query parameters from Observe definition.
o Added observe-cancel definition to WADL and to observable o Added observe-cancel definition to WADL and to observable
interfaces. interfaces.
Changes from -01 to -02 Changes from -01 to -02:
o Updated the date and version, fixed references. o Updated the date and version, fixed references.
o Removed pmin and pmax observe parameters [Ticket #336] o "Removed pmin and pmax observe parameters "[Ticket #336]"."
Changes from -00 to WG Document -01 Changes from -00 to WG Document -01
o Improvements to the Function Set section. o Improvements to the Function Set section.
Changes from -05 to WG Document -00 Changes from -05 to WG Document -00
o Updated the date and version. o Updated the date and version.
Changes from -04 to -05 Changes from -04 to -05
o Made the Observation control parameters to be treated as resources o Made the Observation control parameters to be treated as resources
rather than Observe query parameters. Added Less Than and Greater rather than Observe query parameters. Added Less Than and Greater
skipping to change at page 19, line 38 skipping to change at page 22, line 47
o Defined a Function Set and its guidelines. o Defined a Function Set and its guidelines.
o Added the Link List interface. o Added the Link List interface.
o Added the Linked Batch interface. o Added the Linked Batch interface.
o Improved the WADL interface definition. o Improved the WADL interface definition.
o Added a simple profile example. o Added a simple profile example.
11. References 10. References
10.1. Normative References
11.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>. <http://www.rfc-editor.org/info/rfc2119>.
[RFC5988] Nottingham, M., "Web Linking", RFC 5988, [RFC5988] Nottingham, M., "Web Linking", RFC 5988,
DOI 10.17487/RFC5988, October 2010, DOI 10.17487/RFC5988, October 2010,
<http://www.rfc-editor.org/info/rfc5988>. <http://www.rfc-editor.org/info/rfc5988>.
[RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link
Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, Format", RFC 6690, DOI 10.17487/RFC6690, August 2012,
<http://www.rfc-editor.org/info/rfc6690>. <http://www.rfc-editor.org/info/rfc6690>.
11.2. Informative References 10.2. Informative References
[I-D.ietf-core-dynlink]
Shelby, Z., Vial, M., Koster, M., and C. Groves, "Dynamic
Resource Linking for Constrained RESTful Environments",
draft-ietf-core-dynlink-00 (work in progress), October
2016.
[I-D.ietf-core-resource-directory] [I-D.ietf-core-resource-directory]
Shelby, Z., Koster, M., Bormann, C., and P. Stok, "CoRE Shelby, Z., Koster, M., Bormann, C., and P. Stok, "CoRE
Resource Directory", draft-ietf-core-resource-directory-07 Resource Directory", draft-ietf-core-resource-directory-08
(work in progress), March 2016. (work in progress), July 2016.
[I-D.ietf-core-senml] [I-D.ietf-core-senml]
Jennings, C., Shelby, Z., Arkko, J., and A. Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C.
Ker&#258;[currency units]nen, "Media Types for Sensor Bormann, "Media Types for Sensor Markup Language (SenML)",
Markup Language (SenML)", draft-ietf-core-senml-00 (work draft-ietf-core-senml-03 (work in progress), October 2016.
in progress), April 2016.
[OIC-Core]
"OIC Resource Type Specification v1.1.0", 2016,
<https://openconnectivity.org/resources/specifications>.
[OIC-SmartHome]
"OIC Smart Home Device Specification v1.1.0", 2016,
<https://openconnectivity.org/resources/specifications>.
[OMA-TS-LWM2M]
"Lightweight Machine to Machine Technical Specification",
2016, <http://technical.openmobilealliance.org/Technical/
technical-information/release-program/current-releases/
oma-lightweightm2m-v1-0>.
[oneM2MTS0008]
"TS 0008 v1.3.2 CoAP Protocol Binding", 2016,
<http://www.onem2m.org/technical/published-documents>.
[oneM2MTS0023]
"TS 0023 v2.0.0 Home Appliances Information Model and
Mapping", 2016,
<http://www.onem2m.org/technical/published-documents>.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, DOI 10.17487/RFC3986, January 2005, RFC 3986, DOI 10.17487/RFC3986, January 2005,
<http://www.rfc-editor.org/info/rfc3986>. <http://www.rfc-editor.org/info/rfc3986>.
[RFC6573] Amundsen, M., "The Item and Collection Link Relations",
RFC 6573, DOI 10.17487/RFC6573, April 2012,
<http://www.rfc-editor.org/info/rfc6573>.
[RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service
Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013,
<http://www.rfc-editor.org/info/rfc6763>. <http://www.rfc-editor.org/info/rfc6763>.
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
Protocol (HTTP/1.1): Message Syntax and Routing",
RFC 7230, DOI 10.17487/RFC7230, June 2014,
<http://www.rfc-editor.org/info/rfc7230>.
[RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
Application Protocol (CoAP)", RFC 7252, Application Protocol (CoAP)", RFC 7252,
DOI 10.17487/RFC7252, June 2014, DOI 10.17487/RFC7252, June 2014,
<http://www.rfc-editor.org/info/rfc7252>. <http://www.rfc-editor.org/info/rfc7252>.
[RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396, [RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396,
DOI 10.17487/RFC7396, October 2014, DOI 10.17487/RFC7396, October 2014,
<http://www.rfc-editor.org/info/rfc7396>. <http://www.rfc-editor.org/info/rfc7396>.
Appendix A. Profile example Appendix A. Current Usage of Interfaces and Function Sets
This appendix analyses the current landscape with regards the
definition and use of collections, interfaces and function sets/
profiles. This should be considered when considering the scope of
this document.
In summary it can be seen that there is a lack of consistancy of the
definition and usage of interface description and function sets.
A.1. Constrained RESTful Environments (CoRE) Link Format (IETF)
[RFC6690] assumes that different deployments or application domains
will define the appropriate REST Interface Descriptions along with
Resource Types to make discovery meaningful. It highlights that
collections are often used for these interfaces.
Whilst 3.2/[RFC6690] defines a new Interface Description 'if'
attribute the procedures around it are about the naming of the
interface not what information should be included in the
documentation about the interface.
Function sets are not discussed.
A.2. CoRE Resource Directory (IETF)
[I-D.ietf-core-resource-directory] uses the concepts of collections,
interfaces and function sets.
If defines a number of interfaces: discovery, registration,
registration update, registration removal, read endpoint links,
update endpoint links, registration request interface, removal
request interface and lookup interface. However it does not assign
an inteface description identifier (if=) to these interfaces.
It does define a resource directory function set which specifies
relevant content formats and interfaces to be used between a resource
directory and endpoints. However it does not follow the format
proposed by this document.
A.3. Open Connectivity Foundation (OCF)
The OIC Core Specification [OIC-Core] most closely aligns with the
work in this specification. It makes use of interface descriptions
as per [RFC6690] and has registered several interface identifiers
(https://www.iana.org/assignments/core-parameters/core-
parameters.xhtml#if-link-target-att-value). These interface
descriptors are similar to those defined in this specification. From
a high level perspective:
links list: OCF (oic.if.ll) -> IETF (core.ll)
Note: it's called "link list" in the IETF.
linked batch: OCF (oic.if.b) -> IETF (core.lb)
read-only: OCF (oic.if.r) -> IETF (core.rp)
read-write: OCF (oic.if.rw) -> IETF (core.p)
actuator: OCF (oic.if.a) -> IETF (core.a)
sensor: OCF (oic.if.s) -> IETF (core.s)
batch: No OCF equivalent -> IETF (core.b)
Some of the OCF interfaces make use of collections.
The OIC Core specification does not use the concept of function sets.
It does however discuss the concept of profiles. The OCF defines two
sets of documents. The core specification documents such as
[OIC-Core] and vertical profile specification documents which provide
specific information for specific applications. The OIC Smart Home
Device Specification [OIC-SmartHome] is one such specification. It
provides information on the resource model, discovery and data types.
A.4. oneM2M
OneM2M describes a technology independent functional architecture
[oneM2MTS0023]. In this archictecture the reference points between
functional entities are called "interfaces". This usage does not
match the [RFC6690] concept of interfaces. A more direct comparison
is that of 10.2/[oneM2MTS0023] that defines basic procedures and
resource type-specific procedures utilising REST type create,
retrieve, update, delete, notify actions.
[oneM2MTS0023] does not refer to resource collections however does
define "Group Management Procedures" in 10.2.7/[oneM2MTS0023]. It
does allow bulk management of member resources.
[oneM2MTS0023] does not use the term "function set". [oneM2MTS0008]
describes the binding with the CoAP protocol. In some respects this
document provides a profile of the CoAP protocol in terms of the
protocol elements that need to be supported. However it does not
define any interface descriptions nor collections.
A.5. OMA LWM2M
[OMA-TS-LWM2M] utilises the concept of interfaces. It defines the
following interfaces: Bootstrap, Client Registration, Device
Management and Service Enablement and Information Reporting. It
defines that these have a particular direction (Uplink/Downlink) and
indicates the operations that may be applied to the interface (i.e.
Request Bootstrap, Write, Delete, Register, Update, De-Register,
Create, Read, Write, Delete, Execute, Write Attributes, Discover,
Observe, Cancel Observation, Notify). It then further defines which
objects may occur over the interface. In 6/[OMA-TS-LWM2M] resource
model, identifier and data formats are described.
Whilst it does not formally describe the use of "collections" the use
of a multiple resource TLV allows a hierarchy of resource/sub-
resource.
It does not identify the interfaces through an Interface Description
(if=) attribute.
It does not use the term function set. Informally the specification
could be considered as a function set.
Note: It refers to draft-ietf-core-interfaces-00. It also makes use
of the binding/observation attributes from draft-ietf-dynlink-00 but
does not refer to that document.
Appendix B. Profile example
The following is a short definition of simple profile. This The following is a short definition of simple profile. This
simplistic profile is for use in the examples of this document. simplistic profile is for use in the examples of this document.
+--------------------+-----------+------------+---------+ +--------------------+-----------+------------+---------+
| Function Set | Root Path | RT | IF | | Function Set | Root Path | RT | IF |
+--------------------+-----------+------------+---------+ +--------------------+-----------+------------+---------+
| Device Description | /d | simple.dev | core.ll | | Device Description | /d | simple.dev | core.ll |
| Sensors | /s | simple.sen | core.b | | | | | |
| Actuators | /a | simple.act | core.b | | Sensors | /s | simple.sen | core.b |
| | | | |
| Actuators | /a | simple.act | core.b |
+--------------------+-----------+------------+---------+ +--------------------+-----------+------------+---------+
List of Function Sets Table 3: List of Function Sets
+-------+----------+----------------+---------+------------+ +-------+----------+----------------+---------+------------+
| Type | Path | RT | IF | Data Type | | Type | Path | RT | IF | Data Type |
+-------+----------+----------------+---------+------------+ +-------+----------+----------------+---------+------------+
| Name | /d/name | simple.dev.n | core.p | xsd:string | | Name | /d/name | simple.dev.n | core.p | xsd:string |
| | | | | |
| Model | /d/model | simple.dev.mdl | core.rp | xsd:string | | Model | /d/model | simple.dev.mdl | core.rp | xsd:string |
+-------+----------+----------------+---------+------------+ +-------+----------+----------------+---------+------------+
Device Description Function Set Table 4: Device Description Function Set
+-------------+-------------+----------------+--------+-------------+ +-------------+-------------+----------------+--------+-------------+
| Type | Path | RT | IF | Data Type | | Type | Path | RT | IF | Data Type |
+-------------+-------------+----------------+--------+-------------+ +-------------+-------------+----------------+--------+-------------+
| Light | /s/light | simple.sen.lt | core.s | xsd:decimal | | Light | /s/light | simple.sen.lt | core.s | xsd:decimal |
| | | | | |
| | | | | (lux) | | | | | | (lux) |
| Humidity | /s/humidity | simple.sen.hum | core.s | xsd:decimal | | | | | | |
| Humidity | /s/humidity | simple.sen.hum | core.s | xsd:decimal |
| | | | | |
| | | | | (%RH) | | | | | | (%RH) |
| | | | | |
| Temperature | /s/temp | simple.sen.tmp | core.s | xsd:decimal | | Temperature | /s/temp | simple.sen.tmp | core.s | xsd:decimal |
| | | | | |
| | | | | (degC) | | | | | | (degC) |
+-------------+-------------+----------------+--------+-------------+ +-------------+-------------+----------------+--------+-------------+
Sensors Function Set Table 5: Sensors Function Set
+------+------------+----------------+--------+-------------+ +------+------------+----------------+--------+-------------+
| Type | Path | RT | IF | Data Type | | Type | Path | RT | IF | Data Type |
+------+------------+----------------+--------+-------------+ +------+------------+----------------+--------+-------------+
| LED | /a/{#}/led | simple.act.led | core.a | xsd:boolean | | LED | /a/{#}/led | simple.act.led | core.a | xsd:boolean |
+------+------------+----------------+--------+-------------+ +------+------------+----------------+--------+-------------+
Actuators Function Set Table 6: Actuators Function Set
Authors' Addresses Authors' Addresses
Zach Shelby Zach Shelby
ARM ARM
150 Rose Orchard 150 Rose Orchard
San Jose 95134 San Jose 95134
FINLAND FINLAND
Phone: +1-408-203-9434 Phone: +1-408-203-9434
Email: zach.shelby@arm.com Email: zach.shelby@arm.com
Matthieu Vial Matthieu Vial
 End of changes. 106 change blocks. 
248 lines changed or deleted 565 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/