draft-ietf-core-interfaces-03.txt   draft-ietf-core-interfaces-04.txt 
CoRE Z. Shelby CoRE Z. Shelby
Internet-Draft ARM Internet-Draft ARM
Intended status: Informational M. Vial Intended status: Informational M. Vial
Expires: January 7, 2016 Schneider-Electric Expires: April 21, 2016 Schneider-Electric
M. Koster M. Koster
ARM ARM
July 6, 2015 October 19, 2015
CoRE Interfaces Reusable Interface Definitions for Constrained RESTful Environments
draft-ietf-core-interfaces-03 draft-ietf-core-interfaces-04
Abstract Abstract
This document defines well-known REST interface descriptions for This document defines a set of reusable REST resource design patterns
Batch, Sensor, Parameter and Actuator types for use in contrained web suitable for use in constrained environments, based on IETF CoRE
servers using the CoRE Link Format. A short reference is provided standards for information representation and information exchange.
for each type that can be efficiently included in the interface
description attribute of the CoRE Link Format. These descriptions
are intended to be for general use in resource designs or for
inclusion in more specific interface profiles. In addition, this
document defines the concepts of Function Set and Binding. The
former is the basis element to create RESTful profiles and the latter
helps the configuration of links between resources located on one or
more endpoints.
Status of this Memo Interface types for Sensors, Actuators, Parameters, and resource
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.
Dynamic linking of state updates between resources, either on an
endpoint or between endpoints, is defined with the concept of Link
Bindings. We also define conditional observation attributes that
work with Link Bindings or with simple CoAP Observe [RFC7641].
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 January 7, 2016. This Internet-Draft will expire on April 21, 2016.
Internet-DrafReusable Interface Definitions for Constrained October 2015
Copyright Notice Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the Copyright (c) 2015 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 . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. Function Set . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Interface Types . . . . . . . . . . . . . . . . . . . . . . . 5
3.1. Defining a Function Set . . . . . . . . . . . . . . . . . 4 4. Collections . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.1. Path template . . . . . . . . . . . . . . . . . . . . 5 4.1. Introduction to Collections . . . . . . . . . . . . . . . 5
3.1.2. Resource Type . . . . . . . . . . . . . . . . . . . . 5 4.2. Use Cases for Collections . . . . . . . . . . . . . . . . 6
3.1.3. Interface Description . . . . . . . . . . . . . . . . 5 4.3. Content-Formats for Collections . . . . . . . . . . . . . 7
3.1.4. Data type . . . . . . . . . . . . . . . . . . . . . . 6 4.4. Links and Items in Collections . . . . . . . . . . . . . 7
3.2. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 6 4.5. Queries on Collections . . . . . . . . . . . . . . . . . 9
3.3. Versioning . . . . . . . . . . . . . . . . . . . . . . . . 6 4.6. Observing Collections . . . . . . . . . . . . . . . . . . 9
4. Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.7. Hypermedia Controls on Collections . . . . . . . . . . . 9
4.1. Format . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.8. Collection Types . . . . . . . . . . . . . . . . . . . . 10
4.2. Binding methods . . . . . . . . . . . . . . . . . . . . . 8 4.9. The collection+senml+json Content-Format . . . . . . . . 10
4.3. Binding table . . . . . . . . . . . . . . . . . . . . . . 9 5. Link Bindings and Observe Attributes . . . . . . . . . . . . 11
5. Interface Descriptions . . . . . . . . . . . . . . . . . . . . 10 5.1. Format . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 11 5.2. Binding methods . . . . . . . . . . . . . . . . . . . . . 13
5.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5.3. Binding table . . . . . . . . . . . . . . . . . . . . . . 14
5.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . . 12 5.4. Resource Observation Attributes . . . . . . . . . . . . . 14
5.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6. Interface Descriptions . . . . . . . . . . . . . . . . . . . 15
5.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 14 6.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 17
5.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 14 6.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 18
5.8. Binding . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.4. Hypermedia Collection . . . . . . . . . . . . . . . . . . 19
5.9. Resource Observation Attributes . . . . . . . . . . . . . 16 6.5. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.10. Future Interfaces . . . . . . . . . . . . . . . . . . . . 17 6.6. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 21
5.11. WADL Description . . . . . . . . . . . . . . . . . . . . . 17 6.7. Read-only Parameter . . . . . . . . . . . . . . . . . . . 21
6. Security Considerations . . . . . . . . . . . . . . . . . . . 23 6.8. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 21
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 23 6.9. Binding . . . . . . . . . . . . . . . . . . . . . . . . . 22
8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 23 6.10. Future Interfaces . . . . . . . . . . . . . . . . . . . . 23
9. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6.11. WADL Description . . . . . . . . . . . . . . . . . . . . 23
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 25 7. Function Sets and Profiles . . . . . . . . . . . . . . . . . 29
10.1. Normative References . . . . . . . . . . . . . . . . . . . 25
10.2. Informative References . . . . . . . . . . . . . . . . . . 25 Internet-DrafReusable Interface Definitions for Constrained October 2015
Appendix A. Profile example . . . . . . . . . . . . . . . . . . . 25
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 26 7.1. Defining a Function Set . . . . . . . . . . . . . . . . . 29
7.1.1. Path template . . . . . . . . . . . . . . . . . . . . 30
7.1.2. Resource Type . . . . . . . . . . . . . . . . . . . . 30
7.1.3. Interface Description . . . . . . . . . . . . . . . . 30
7.1.4. Data type . . . . . . . . . . . . . . . . . . . . . . 31
7.2. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 31
7.3. Versioning . . . . . . . . . . . . . . . . . . . . . . . 31
8. Security Considerations . . . . . . . . . . . . . . . . . . . 31
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32
10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 32
11. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 32
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 34
12.1. Normative References . . . . . . . . . . . . . . . . . . 34
12.2. Informative References . . . . . . . . . . . . . . . . . 34
Appendix A. Profile example . . . . . . . . . . . . . . . . . . 35
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 36
1. Introduction 1. Introduction
The Constrained RESTful Environments (CoRE) working group aims at IETF Standards for machine to machine communication in constrained
realizing the REST architecture in a suitable form for the most environments describe a REST protocol and a set of related
constrained nodes (e.g. 8-bit microcontrollers with limited RAM and information standards that may be used to represent machine data and
ROM) and networks (e.g. 6LoWPAN). CoRE is aimed at machine-to- machine metadata in REST interfaces.. CoRE Link-format is a standard
machine (M2M) applications such as smart energy and building for doing Web Linking [RFC5988] in constrained environments. SenML
automation. is a simple data model and representation format for composite and
complex structured resources. CoRE Link-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 and static interfaces result in fragility. The humans in the loop. Machine application clients must be able to
discovery of resources provided by an HTTP Web Server is typically adapt to different resource organizations without advance knowledge
called Web Linking [RFC5988]. The use of Web Linking for the of the specific data structures hosted by each connected thing. The
description and discovery of resources hosted by constrained web use of Web Linking for the description and discovery of resources
servers is specified by the CoRE Link Format [RFC6690] and can be hosted by constrained web servers is specified by CoRE Link Format
used by CoAP [RFC7252] or HTTP servers. The CoRE Link Format defines [RFC6690]. CoRE Link Format additionally defines a link attribute
an attribute that can be used to describe the REST interface of a for Interface Type ("if") that can be used to describe the REST
resource, and may include a link to a description document. This interface of a resource, and may include a link to a description
memo describes how other specifications can combine resources with a document.
well-known interface to create new CoRE RESTful profiles. A CoRE
profile is based on the concept of Function Set, which is a group of This document defines a set of Link Format compatible Interface Types
REST resources providing a service in a distributed system. In for some common design patterns that enable the server side
addition, the notion of Binding is introduced in order to create a composition and organization, and client side discovery and
synchronization link between two resources. This document also consumption, of machine resources using Web Linking. An Interface
defines well-known interface descriptions for Batch, Sensor, Type may describe a resource in terms of it's associated content
Parameter and Actuator types to compose new Function Sets or for formats, data types, URI templates, REST methods, parameters, and
standalone use in a constrained web server. A short reference is responses. Basic interface types are defined for sensors, actuators,
provided for each type that can be efficiently included in the and properties. A set of collection types is defined for organizing
interface description (if=) attribute of the CoRE Link Format.
Internet-DrafReusable Interface Definitions for Constrained October 2015
resources for discovery, and for various forms of bulk interaction
with resource sets using typed embedding links.
This document introduces the concept of a Link Binding, which defines
a new link relation type to create a dynamic link between resources
over which to exchange state updates. Specifically, a Link Binding
is a link for binding the state of 2 resources together such that
updates to one are sent over the link to the other. CoRE Link Format
representations are used to configure, inspect, and maintain Link
Bindings. This document additionally defines a set of conditional
Observe Attributes for use with Link Bindings and with the standalone
CoRE Observe [RFC7641] method.
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
knowledge of the expected interface types. In this sense the
Interface Type acts in a similar way as a Content-Format, but as a
selector for a high level functional abstraction. Interface types
may also be provided with hypermedia controls and affordances to
drive client interaction using the principles of HATEOAS. In this
case, the Interface Types serve as constructor templates for resource
organization and hypermedia annotation.
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", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119]. document are to be interpreted as described in [RFC2119].
This specification requires readers to be familiar with all the terms This specification requires readers to be familiar with all the terms
and concepts that are discussed in [RFC5988] and [RFC6690]. This and concepts that are discussed in [RFC5988] and [RFC6690]. This
specification makes use of the following additional terminology: specification makes use of the following additional terminology:
Interface Type: A resource attribute which describes the interface
exposed by the resource in terms of content formats, REST methods,
parameters, and other related characteristics.
Collection: A resource which contains set of related resources,
referenced by a list of links and optionally consisting of
subresources.
Internet-DrafReusable Interface Definitions for Constrained October 2015
Link Binding: A unidirectional logical link between a source
resource and a destination resource, over which state information
is synchronized.
Resource Discovery: The process allowing a web client to identify
resources being hosted on a web server.
Gradual Reveal: A REST design where resources are discovered
progressively using Web Linking.
Function Set: A group of well-known REST resources that provides a Function Set: A group of well-known REST resources that provides a
particular service. particular service.
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 Device: An IP smart object running a web server that hosts a group
of Function Set instances from a profile. of Function Set instances from a profile.
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.
Resource Discovery: The process allowing a web client to identify 3. Interface Types
resources being hosted on a web server.
Gradual Reveal: A REST design where resources are discovered An Interface Type definition may describe a resource in terms of it's
progressively using Web Linking. associated content formats, data types, URI templates, REST methods,
parameters, and responses.
Binding: A unidirectional logical link between a source resource and 4. Collections
a destination resource.
3. Function Set 4.1. Introduction to Collections
This section defines how a set of REST resources can be created A Collection is a resource which represents one or more related
called a function set. A Function Set is similar to a function block resources. Within this document, a collection refers to a collection
in the sense that it consists of input, output and parameter with characteristics defined in this document. A Collection
resources and contains internal logic. A Function Set can have a Interface Type consists of a set of links and a set of items pointed
subset of mandatory inputs, outputs and parameters to provide minimum to by the links which may be sub-resources of the collection
interoperability. It can also be extended with manufacturer/ resource. The collection types described in this document are Link
user-specific resources. A device is composed of one or more List, Batch, Linked Batch, and Hypermedia Collection.
Function Set instances.
An example of function sets can be found from the CoRE Resource The links in a collection are represented in CoRE Link-Format
Directory specification that defines REST interfaces for Content-Formats including JSON and CBOR variants, and the items in
registration, group and lookup [I-D.ietf-core-resource-directory]. the collection may be represented by senml, including JSON and CBOR
The OMA Lightweight M2M standard [REF] also defines a function set variants. In general, a collection may support items of any
structure called an Objects that use integer path, instance and available Content-Format.
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.
3.1. Defining a Function Set Internet-DrafReusable Interface Definitions for Constrained October 2015
In a Function Set, types of resources are defined. Each type A particular resource item may be a member of more than one
includes a human readable name, a path template, a Resource Type for collection at a time by being linked to, but may only be a
discovery, the Interface Definition and the data type and allowed subresource of one collection.
values. A Function Set definition may also include a field
indicating if a sub-resource is mandatory or optional.
3.1.1. Path template Some collections may have pre-configured items and links, and some
collections may support dynamic creation and removal of items and
links. Likewise, modification of items in some collections may be
permitted, and not in others.
A Function Set is a container resource under which its sub-resources Collections may support link embedding, which is analogous to an
are organized. The profile defines the path to each resource of a image tag (link) causing the image to display inline in a browser
Function Set in a path template. The template can contain either window. Resources pointed to by embedded links in collections may be
relative paths or absolute paths depending on the profile needs. An interacted with using bulk operations on the collection resource.
absolute Function Set should be located at its recommended root path For example, performing a GET on a collection resource may return a
on a web server, however it can be located under an alternative path single representation containing all of the linked resources.
if necessary (for example multi-purpose devices, gateways etc.). A
relative Function Set can be instantiated as many times as needed on
a web server with an arbitrary root path. However some Function Sets
(e.g. device description) only make sense as singletons.
The path template includes a possible index {#} parameter, and Links in collections may be selected for processing by a particular
possible fixed path segments. The index {#} allows for multiple request by using Query Filtering as described in CoRE Link-Format
instances of this type of resource, and can be any string. The root [RFC6690].
path and the indexes are the only variable elements in a path
template. All other path segments should be fixed.
3.1.2. Resource Type 4.2. Use Cases for Collections
Each root resource of a Function Set is assigned a Resource Type Collections may be used to provide gradual reveal of resources on an
parameter, therefore making it possible to discover it. Each sub- endpoint. There may be a small set of links at the .well-known/core
resource of a Function Set is also assigned a Resource Type location, which may in turn point to other collections of resources
parameter. This Resource Type is used for resource discovery and is that represent device information, device configuration, device
usually necessary to discover optional resources supported on a management, and various functional clusters of resources on the
specific device. The Resource Type of a Function Set may also be device.
used for service discovery and can be exported to DNS-SD [RFC6763]
for example.
The Resource Type parameter defines the value that should be included A collection may provide resource encapsulation, where link embedding
in the rt= field of the CoRE Link Format when describing a link to may be used to provide a single resource with which a client may
this resource. The value SHOULD be in the form "namespace.type" for interact to obtain a set of related resource values. For example, a
root resources and "namespace.type.subtype" for sub-resources. This collection for manufacturer parameters may consist of manufacturer
naming convention facilitates resource type filtering with the name, date of manufacture, location of manufacture, and serial number
/.well-known/core resource. However a profile could allow mixing in resources which can be read as a single senml data object.
foreign namespace references within a Function Set to import external
references from other object models (e.g. SenML and UCUM).
3.1.3. Interface Description A collection may be used to group a set of like resources for bulk
state update or actuation. For example, the brightness control
resources of a number of luminaries may be grouped by linking to them
in a collection. The collection type may support receiving a single
update form a client and sending that update to each resource item in
the collection.
The Interface Description parameter defines the REST interface for Items may be sub-resources of the collection resource. This enables
that type of resource. Several base interfaces are defined in updates to to multiple items in the collection to be processed
Section 5 of this document. For a given profile, the Interface together within the context of the collection resource.
Description may be inferred from the Resource Type. In that case the
Interface Description MAY be elided from link descriptions of
resource types defined in the profile, but should be included for
custom extensions to the profile.
The root resource of a Function Set should provide a list of links to Internet-DrafReusable Interface Definitions for Constrained October 2015
its sub-resources in order to offer gradual reveal of resources. The
CoRE Link List interface defined in Section 5.1 offers this
functionality so a root resource should support this interface or a
derived interface like CoRE Batch (See Section 5.2).
3.1.4. Data type Items may be dynamically created in a collection along with their
hyperlinks. This provides an "item factory" pattern which can serve
as a resource creation mechanism for dynamic resources. This pattern
is also useful for creating temporary resources for the
implementation of dynamic phenomena like commands, actions, and
events using REST design patterns. Item creation uses the collection
Content-Format which allows specification of links and item state in
a single representation.
The Data Type field defines the type of value (and possible range) 4.3. Content-Formats for Collections
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
text and SenML Media types for the actual format of this data. A
profile may restrict the list of supported content types for the CoRE
interfaces or define new interfaces with new content types.
3.2. Discovery The collection interfaces by default use CoRE Link-Format for the
link representations and SenML or text/plain for representations of
items. The examples given are for collections that expose resources
and links in these formats. In addition, a new "collection" Content-
Format is defined based on the SenML framework which represents both
links and items in the collection.
A device conforming to a profile SHOULD make its resources The choice of whether to return a representation of the links or of
discoverable by providing links to the resources on the path /.well- the items or of the collection format is determined by the accepts
known/core as defined in [RFC6690]. All resources hosted on a device header option in the request. Likewise, the choice of updating link
SHOULD be discoverable either with a direct link in /.well-known/core metadata or item data or the collection resource itself is determined
or by following successive links starting from /.well-known/core. by the Content-Format option in the header of the update request
operation.
The root path of a Function Set instance SHOULD be directly The default Content-Formats for collection types described in this
referenced in /.well-known/core in order to offer discovery at the document are:
first discovery stage. A device with more than 10 individual
resources SHOULD only expose Function Set instances in /.well-known/
core to limit the size of this resource.
In addition, a device MAY register its resources to a Resource Links: application/link-format, application/link-format+json
Directory using the registration interface defined in
[I-D.ietf-core-resource-directory] if such a directory is available.
3.3. Versioning Items: application/senml+json, text/plain
A profile should track Function Set changes to avoid incompatibility Collection: application/collection+senml+json
issues. Evolutions in a Function Set SHOULD be backward compatible.
4. Bindings 4.4. Links and Items in Collections
In a M2M RESTful environment, endpoints exchange the content of their Links use CoRE Link-Format representation by default and may point to
resources to operate the distributed system. Beforehand, a any resource reachable from the context of the collection. This
configuration phase is necessary to determine how the resources of includes absolute links and links that point to other network
the different endpoints are related to each other. This can be done locations if the context of the collection allows. Links to sub-
either automatically using discovery mechanisms or by means of human resources in the collection MUST have a path-element starting with
intervention and a so-called commissioning tool. In this document the resource name, as per RFC3986 [RFC3986]. Links to resources in
the abstract relationship between two resources is called a Binding. the global context MUST start with a root path identifier
[RFC5988].Links to other collections are formed per RFC3986.
The configuration phase necessitates the exchange of binding Examples of links:
information so a format recognized by all CoRE endpoints is
essential. This document defines a format based on the CoRE Link- Internet-DrafReusable Interface Definitions for Constrained October 2015
Format to represent binding information along with the rules to
define a binding method which is a specialized relationship between </sen/>;if="core.lb" : Link to the /sen/ collection describing it as
two resources. The purpose of a binding is to synchronize the a core.lb type collection (Linked Batch)
content between a source resource and a destination resource. The
destination resource MAY be a group resource if the authority </sen/>;rel="grp" : Link to the /sen/ collection indicating that
/sen/ is a member of a group in the collection in which the link
appears.
<"/sen/temp">;rt="temperature" : An absolute link to the resource at
the path /sen/temp
<temp>;rt="temperature" : Link to the temp subresource of the
collection in which this link appears.
<temp>;anchor="/sen/" : A link to the temp 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
identified in the collection by resource name.
Links in the collection MAY be Read, Updated, Added, or Removed using
the CoRE Link-Format or JSON Merge-Patch Content-Formats on the
collection resource. Reading links uses the GET method and returns
an array or list containing the link-values of all selected links.
Links may be added to the collection using POST or PATCH methods.
Updates to links MUST use the PATCH method and MAY use query
filtering to select links for updating. The PATCH method on links
MUST use the JSON Merge-Patch Content-Format (application/merge-
patch+json) specified in RFC7396 [RFC7396] .
Items in the collection SHOULD be represented using the SenML
(application/senml+json) or plain text (text/plain) Content-Formats,
depending on whether the representation is of a single data point or
multiple data points. Items MAY be represented using any supported
Content-Format.
Link Embedding enables the bulk processing of items in the collection
using a single operation targeting the collection resource. A subset
of resources in the collection may be selected for operation using
Query Filtering. Bulk Read operations using GET return a SenML
representation of all selected resources. Bulk item Update
operations using PUT or POST apply the payload document to all
selected resource items in the collection, using a either a Batch or
Group update policy. A Batch update is performed by applying the
resource values in the payload document to all resources in the
collection that match any resource name in the payload document.
Group updates are performed by applying the payload document to each
item in the collection. Group updates are indicated by the link
relation type rel="grp" in the link.
Internet-DrafReusable Interface Definitions for Constrained October 2015
The collection resource SHOULD represented using the
collection+senml+json Content-Format. The Hypermedia Collection type
is the only collection type which supports this representation.
Reading a collection using this content-format returns a
representation of the links and the items in the collection.
Performing a POST operation using this Content-Format MAY create one
or more new item(s) and their corresponding links in the collection.
Performing a PUT operation on this resource replaces the entire set
of links and items with the payload. This Content-Format is
described in section Section 4.9. Implementations MAY provide an
alternate method using POST in a Content-Format used by the items in
the collection which creates a default link-value and system-assigned
resource name. Such implementations MAY create sub-resources of the
collection resource.
4.5. Queries on Collections
Collections MAY support query filtering as defined in CoRE Link-
Format [RFC6690]. Operations targeting either the links or the items
MAY select a subset of links and items in the collection by using
query filtering. The Content-Format specified in the request header
selects whether links or items are targeted by the operation.
4.6. Observing Collections
Resource Observation using CoAP [RFC7252] MAY be supported on items
in a collection. A subset of the conditional observe parameters MAY
be specified to apply. In most cases pmin and pmax are useful.
Resource observation on a collection's items resource MAY report any
changes of resource state in any item in the collection. Observation
Responses, or notifications, SHOULD provide representations of the
resources that have changed in SenML Content-Format. Notifications
MAY include multiple observations of a particular resource, with
SenML time stamps indicating the observation times.
4.7. Hypermedia Controls on Collections
Additional Hypermedia controls may be defined to enable clients to
automatically consume the collection resources. Typically, the
developer may map application level semantics onto collection
operations. For example, invoking an Action on an actuator may be
defined as creating an Action item resource in a collection of
Actions associated with the actuator, each item in the collection
representing a past, current, or future action to be processed by the
actuator. Removing the item could cancel any pending or curent long-
running action, and removing a completed action could free up
resources for new actions to be invoked. A Hypermedia control for
this pattern might provide a semantic name for the action, for
Internet-DrafReusable Interface Definitions for Constrained October 2015
example "Change Brightness", and might direct the client to supply a
SenML representation of parameters for the action as well as provide
instructions on what method (POST) to use and how to construct the
URI (the collection URI in this case) if required. An example of
this hypermedia control is shown below.
4.8. Collection Types
There are four collection types defined in this document:
+---------------------+----------+----------------------------------+
| Collection Type | if= | Content-Formats |
+---------------------+----------+----------------------------------+
| Link List | core.ll | link-format |
| Batch | core.b | link-format, senml |
| Linked Batch | core.lb | link-format, senml |
| Hypermedia | core.hc | link-format, senml, |
| Collection | | collection+senml |
| Binding | core.bnd | link-format |
+---------------------+----------+----------------------------------+
Each collection type MAY support a subset of the methods and
functions described above. For the first three collection types, the
methods and functions are defined in the corresponding Interface
Description. The Hypermedia Collection SHOULD expose hypermedia
controls to applications to indicate which methods and functions are
supported.
4.9. The collection+senml+json Content-Format
The collection+senml+json Content-Format is used to represent all of
the attributes and resources of a collection in a single format.
This is accomplished by extending the SenmL format by adding a links
element "l". The links element is formatted as an array of links in
the application/link-format+json Content-Format with the tag "l"
which follows the structure of the "e" element. An example of this
format is given below.
Internet-DrafReusable Interface Definitions for Constrained October 2015
{
"bn":"/ep/sen/"
"e":[
{ "n": "light", "v": 123, "u": "lx" },
{ "n": "temp", "v": 27.2, "u": "degC" },
{ "n": "humidity", "v": 80, "u": "%RH" }],
"l":[
{ "href":"/ep/sen/", "rel":"self", "if": "core.hc", "rt": "ms" },
{ "href":"light", "rt":"core.s" },
{ "href":"temp", "rt":"core.s" },
{ "href":"humidity", "rt":"core.s" }]
}
5. Link Bindings and Observe Attributes
In a M2M RESTful environment, endpoints may directly exchange the
content of their resources to operate the distributed system. For
example, a light switch may supply on-off control information that
may be sent directly to a light resource for on-off control.
Beforehand, a configuration phase is necessary to determine how the
resources of the different endpoints are related to each other. This
can be done either automatically using discovery mechanisms or by
means of human intervention and a so-called commissioning tool. In
this document the abstract relationship between two resources is
called a link Binding. The configuration phase necessitates the
exchange of binding information so a format recognized by all CoRE
endpoints is essential. This document defines a format based on the
CoRE Link-Format to represent binding information along with the
rules to define a binding method which is a specialized relationship
between two resources. The purpose of a binding is to synchronize
the content between a source resource and a destination resource.
The destination resource MAY be a group resource if the authority
component of the destination URI contains a group address (either a component of the destination URI contains a group address (either a
multicast address or a name that resolves to a multicast address). multicast address or a name that resolves to a multicast address).
Since a binding is unidirectional, the binding entry defining a Since a binding is unidirectional, the binding entry defining a
relationship is present only on one endpoint. The binding entry may relationship is present only on one endpoint. The binding entry may
be located either on the source or the destination endpoint depending be located either on the source or the destination endpoint depending
on the binding method. The following table gives a summary of the on the binding method. The following table gives a summary of the
binding methods described in more detail in Section 4.2. binding methods described in more detail in Section 5.2.
+---------+------------+-------------+---------------+ +---------+------------+-------------+---------------+
| Name | Identifier | Location | Method | | Name | Identifier | Location | Method |
+---------+------------+-------------+---------------+ +---------+------------+-------------+---------------+
| Polling | poll | Destination | GET | | Polling | poll | Destination | GET |
| Observe | obs | Destination | GET + Observe | | Observe | obs | Destination | GET + Observe |
| Push | push | Source | PUT | | Push | push | Source | PUT |
+---------+------------+-------------+---------------+ +---------+------------+-------------+---------------+
4.1. Format Internet-DrafReusable Interface Definitions for Constrained October 2015
Since Binding lies in the creation of a link between two resources, 5.1. Format
Since Binding involves the creation of a link between two resources,
Web Linking and the CoRE Link-Format are a natural way to represent Web Linking and the CoRE Link-Format are a natural way to represent
binding information. This involves the creation of a new relation binding information. This involves the creation of a new relation
type, purposely named "boundto". In a Web link with this relation type, purposely named "boundto". In a Web link with this relation
type, the target URI contains the location of the source resource and type, the target URI contains the location of the source resource and
the context URI points to the destination resource. The Web link the context URI points to the destination resource. The Web link
attributes allow a fine-grained control of the type of attributes allow a fine-grained control of the type of
synchronization exchange along with the conditions that trigger an synchronization exchange along with the conditions that trigger an
update. This specification defines the attributes below: update. This specification defines the attributes below:
+--------------------+-----------+------------------+ +--------------------+-----------+------------------+
skipping to change at page 8, line 15 skipping to change at page 12, line 40
Bind Method: This is the identifier of a binding method which Bind Method: This is the identifier of a binding method which
defines the rules to synchronize the destination resource. This defines the rules to synchronize the destination resource. This
attribute is mandatory. attribute is mandatory.
Minimum Period: When present, the minimum period indicates the Minimum Period: When present, the minimum period indicates the
minimum time to wait (in seconds) before sending a new minimum time to wait (in seconds) before sending a new
synchronization message (even if it has changed). In the absence synchronization message (even if it has changed). In the absence
of this parameter, the minimum period is up to the notifier. of this parameter, the minimum period is up to the notifier.
Maximum Period: When present, the maximum period indicates the Maximum Period: When present, the maximum period indicates the
maximum time in seconds between two consecutive syncronization maximum time in seconds between two consecutive state
messages (regardless if it has changed). In the absence of this synchronization messages (regardless if it has changed). In the
parameter, the maximum period is up to the notifier. The maximum absence of this parameter, the maximum period is up to the
period MUST be greater than the minimum period parameter (if notifier. The maximum period MUST be greater than the minimum
present). period parameter (if present).
Change Step: When present, the change step indicates how much the Change Step: When present, the change step indicates how much the
value of a resource SHOULD change before sending a new value of a resource SHOULD change before sending a new
notification (compared to the value of the last notification). notification (compared to the value of the last notification).
This parameter has lower priority than the period parameters, thus This parameter has lower priority than the period parameters, thus
even if the change step has been fulfilled, the time since the even if the change step has been fulfilled, the time since the
last notification SHOULD be between pmin and pmax. last notification SHOULD be between pmin and pmax.
Greater Than: When present, Greater Than indicates the upper limit Greater Than: When present, Greater Than indicates the upper limit
value the resource value SHOULD cross before sending a new value the resource value SHOULD cross before sending a new
Internet-DrafReusable Interface Definitions for Constrained October 2015
notification. This parameter has lower priority than the period notification. This parameter has lower priority than the period
parameters, thus even if the Greater Than limit has been crossed, parameters, thus even if the Greater Than limit has been crossed,
the time since the last notification SHOULD be between pmin and the time since the last notification SHOULD be between pmin and
pmax. pmax.
Less Than: When present, Less Than indicates the lower limit value Less Than: When present, Less Than indicates the lower limit value
the resource value SHOULD cross before sending a new notification. the resource value SHOULD cross before sending a new notification.
This parameter has lower priority than the period parameters, thus This parameter has lower priority than the period parameters, thus
even if the Less Than limit has been crossed, the time since the even if the Less Than limit has been crossed, the time since the
last notification SHOULD be between pmin and pmax. last notification SHOULD be between pmin and pmax.
4.2. Binding methods 5.2. Binding methods
A binding method defines the rules to generate the web-transfer A binding method defines the rules to generate the web-transfer
exchanges that will effectively send content from the source resource exchanges that will effectively send content from the source resource
to the destination resource. The description of a binding method to the destination resource. The description of a binding method
must define the following aspects: must define the following aspects:
Identifier: This is value of the "bind" attribute used to identify Identifier: This is value of the "bind" attribute used to identify
the method. the method.
Location: This information indicates whether the binding entry is Location: This information indicates whether the binding entry is
skipping to change at page 9, line 27 skipping to change at page 13, line 50
Polling: The Polling method consists of sending periodic GET Polling: The Polling method consists of sending periodic GET
requests from the destination endpoint to the source resource and requests from the destination endpoint to the source resource and
copying the content to the destination resource. The binding copying the content to the destination resource. The binding
entry for this method MUST be stored on the destination endpoint. entry for this method MUST be stored on the destination endpoint.
The destination endpoint MUST ensure that the polling frequency The destination endpoint MUST ensure that the polling frequency
does not exceed the limits defined by the pmin and pmax attributes does not exceed the limits defined by the pmin and pmax attributes
of the binding entry. The copying process MAY filter out content of the binding entry. The copying process MAY filter out content
from the GET requests using value-based conditions (e.g Change from the GET requests using value-based conditions (e.g Change
Step, Less Than, Greater Than). Step, Less Than, Greater Than).
Observe: The Observe method relies on the Publish/Subscribe pattern Observe: The Observe method creates an observation relationship
thus an observation relationship is created between the between the destination endpoint and the source resource. On each
destination endpoint and the source resource. On each
notification the content from the source resource is copied to the notification the content from the source resource is copied to the
destination resource. The creation of the observation destination resource. The creation of the observation
relationship requires the CoAP Observation mechanism relationship requires the CoAP Observation mechanism [RFC7641]
[I-D.ietf-core-observe] hence this method is only permitted when
the resources are made available over CoAP. The binding entry for Internet-DrafReusable Interface Definitions for Constrained October 2015
this method MUST be stored on the destination endpoint. The
binding conditions are mapped as query string parameters (see hence this method is only permitted when the resources are made
Section 5.9). available over CoAP. The binding entry for this method MUST be
stored on the destination endpoint. The binding conditions are
mapped as query string parameters (see Section 5.4).
Push: When the Push method is assigned to a binding, the source Push: When the Push method is assigned to a binding, the source
endpoint sends PUT requests to the destination resource when the endpoint sends PUT requests to the destination resource when the
binding condition attributes are satisfied for the source binding condition attributes are satisfied for the source
resource. The source endpoint MUST only send a notification resource. The source endpoint MUST only send a notification
request if the binding conditions are met. The binding entry for request if the binding conditions are met. The binding entry for
this method MUST be stored on the source endpoint. this method MUST be stored on the source endpoint.
4.3. Binding table 5.3. Binding table
The binding table is a special resource that gives access to the The binding table is a special resource that gives access to the
bindings on a endpoint. A binding table resource MUST support the bindings on a endpoint. A binding table resource MUST support the
Binding interface defined in Section 5.8. A profile SHOULD allow Binding interface defined in Section 6.9. A profile SHOULD allow
only one resource table per endpoint. only one resource table per endpoint.
5. Interface Descriptions 5.4. Resource Observation Attributes
When resource interfaces following this specification are made
available over CoAP, the CoAP Observation mechanism [RFC7641] MAY be
used to observe any changes in a resource, and receive asynchronous
notifications as a result. In addition, a set of query string
parameters are defined here to allow a client to control how often a
client is interested in receiving notifications and how much a
resource value should change for the new representation to be
interesting. These query parameters are described in the following
table. A resource using an interface description defined in this
specification and marked as Observable in its link description SHOULD
support these observation parameters. The Change Step parameter can
only be supported on resources with an atomic numeric value.
These query parameters MUST be treated as resources that are read
using GET and updated using PUT, and MUST NOT be included in the
Observe request. Multiple parameters MAY be updated at the same time
by including the values in the query string of a PUT. Before being
updated, these parameters have no default value.
Internet-DrafReusable Interface Definitions for Constrained October 2015
+----------------+------------------+------------------+
| Resource | Parameter | Data Format |
+----------------+------------------+------------------+
| Minimum Period | /{resource}?pmin | xsd:integer (>0) |
| Maximum Period | /{resource}?pmax | xsd:integer (>0) |
| Change Step | /{resource}?st | xsd:decimal (>0) |
| Less Than | /{resource}?lt | xsd:decimal |
| Greater Than | /{resource}?gt | xsd:decimal |
+----------------+------------------+------------------+
Minimum Period: When present, the minimum period indicates the
minimum time to wait (in seconds) before sending a new
synchronization message (even if it has changed). In the absence
of this parameter, the minimum period is up to the notifier.
Maximum Period: When present, the maximum period indicates the
maximum time in seconds between two consecutive state
synchronization messages (regardless if it has changed). In the
absence of this parameter, the maximum period is up to the
notifier. The maximum period MUST be greater than the minimum
period parameter (if present).
Change Step: When present, the change step indicates how much the
value of a resource SHOULD change before sending a new
notification (compared to the value of the last notification).
This parameter has lower priority than the period parameters, thus
even if the change step has been fulfilled, the time since the
last notification SHOULD be between pmin and pmax.
Greater Than: When present, Greater Than indicates the upper limit
value the resource value SHOULD cross before sending a new
notification. This parameter has lower priority than the period
parameters, thus even if the Greater Than limit has been crossed,
the time since the last notification SHOULD be between pmin and
pmax.
Less Than: When present, Less Than indicates the lower limit value
the resource value SHOULD cross before sending a new notification.
This parameter has lower priority than the period parameters, thus
even if the Less Than limit has been crossed, the time since the
last notification SHOULD be between pmin and pmax.
6. Interface Descriptions
This section defines REST interfaces for Link List, Batch, Sensor, This section defines REST interfaces for Link List, Batch, Sensor,
Parameter, Actuator and Binding table resources. Variants such as Parameter, Actuator and Binding table resources. Variants such as
Linked Batch or Read-Only Parameter are also presented. Each type is Linked Batch or Read-Only Parameter are also presented. Each type is
described along with its Interface Description attribute value and described along with its Interface Description attribute value and
Internet-DrafReusable Interface Definitions for Constrained October 2015
valid methods. These are defined for each interface in the table valid methods. These are defined for each interface in the table
below. These interfaces can support plain text and/or SenML Media below. These interfaces can support plain text and/or SenML Media
types. 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 specification.
Although these interface descriptions are intended to be used with Although these interface descriptions are intended to be used with
the CoRE Link Format, they are applicable for use in any REST the CoRE Link Format, they are applicable for use in any REST
interface definition. interface 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 | | Interface | if= | Methods | Content-Formats |
+-------------------+----------+------------------------------------+ +-----------------+----------+-----------------+--------------------+
| Link List | core.ll | GET | | Link List | core.ll | GET | link-format |
| Batch | core.b | GET, PUT, POST (where applicable) | | Batch | core.b | GET, PUT, POST | link-format, senml |
| Linked Batch | core.lb | GET, PUT, POST, DELETE (where | | Linked Batch | core.lb | GET, PUT, POST, | link-format, senml |
| | | applicable) | | | | DELETE | |
| Sensor | core.s | GET | | Sensor | core.s | GET | link-format, |
| Parameter | core.p | GET, PUT | | | | | text/plain |
| Read-only | core.rp | GET | | Parameter | core.p | GET, PUT | link-format, |
| Parameter | | | | | | | text/plain |
| Actuator | core.a | GET, PUT, POST | | Read-only | core.rp | GET | link-format, |
| Binding | core.bnd | GET, POST, DELETE | | Parameter | | | text/plain |
+-------------------+----------+------------------------------------+ | Actuator | core.a | GET, PUT, POST | link-format, |
| | | | text/plain |
| Binding | core.bnd | GET, POST, | link-format |
| | | DELETE | |
+-----------------+----------+-----------------+--------------------+
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 A. These links are used in the
subsequent examples below. subsequent examples below.
Internet-DrafReusable Interface Definitions for Constrained October 2015
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 6.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 type, 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 type. The request returns a list of application/link-format content format. The request returns a list
URI references with absolute paths to the resources as defined in of URI references with absolute paths to the resources as defined in
CoRE Link Format. This interface is typically used with a parent CoRE Link Format. This interface is typically used with a parent
resource to enumerate sub-resources but may be used to reference any resource to enumerate sub-resources but may be used to reference any
resource on a web server. 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 6.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 type supports the
same methods as its sub-resources, and can be used to read (GET), set same methods as its sub-resources, and can be used to read (GET),
(PUT) or toggle (POST) the values of those sub-resource with a single update (PUT) or apply (POST) the values of those sub-resource with a
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-
Internet-DrafReusable Interface Definitions for Constrained October 2015
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.
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 6.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 type of application/link-format simply appends method and a content format of application/link-format simply appends
new resources 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
DELETE request empties the current collection of links. All other DELETE request removes the entire collection. All other requests
requests available for a basic Batch are still valid for a Linked available for a basic Batch are still valid for a Linked Batch.
Batch.
The following example interacts with a Linked Batch /l and creates a The following example interacts with a Linked Batch /l/ and creates a
collection containing /s/light, /s/temp and /s/humidity in 2 steps. collection containing /s/light, /s/temp and /s/humidity in 2 steps.
Req: POST /l (Content-type: application/link-format) Internet-DrafReusable Interface Definitions for Constrained October 2015
Req: POST /l/ (Content-Format: application/link-format)
</s/light>,</s/temp> </s/light>,</s/temp>
Res: 2.04 Changed Res: 2.04 Changed
Req: GET /l Req: GET /l/
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" },
} }
Req: POST /l (Content-type: application/link-format) Req: POST /l/ (Content-Format: application/link-format)
</s/humidity> </s/humidity>
Res: 2.04 Changed Res: 2.04 Changed
Req: GET /l (Accept: application/link-format) Req: GET /l/ (Accept: application/link-format)
Res: 2.05 Content (application/link-format) Res: 2.05 Content (application/link-format)
</s/light>,</s/temp>,</s/humidity> </s/light>,</s/temp>,</s/humidity>
Req: GET /l Req: GET /l/
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.04 Changed Res: 2.02 Deleted
5.4. Sensor 6.4. Hypermedia Collection
The Hypermedia Collection interface MAY provide a full set of the
methods and link relation types described in section Section 4 of
this document.
The following example interacts with a Hypermedia Collection at
/act1/actions/ by creating a new resource with Parameter sub-
resources newVal, tTime. The example depicts an actuation operation
with a new actuator value of 86.3% and a transition time of 10
seconds. The returned location of the created resource is then read,
and a response is returned which includes the remaining time for the
operation to complete "rTime". Then, the operation is cancelled by
sending a DELETE operation to the location of the created resource
that represents the running action.
Internet-DrafReusable Interface Definitions for Constrained October 2015
Req: POST /Act1/Actions/
Content-Format: application/collection+senml_json
Pl: [{"n":newVal", "v":86.3}, {"n":tTime", "v":10}]
Res: 2.01 Created
Location: Action1234
Req: GET /Act1/Actions/Action1234
Accepts: application/senml+json
Res: 2.05 Content
Pl: [{"n":newVal", "v":86.3},
{"n":tTime", "v":10},
{"n":"rTime", "v":"8.87"}]
Req: DELETE /Act1/Actions/Action1234
Res: 2.02 Deleted
Req: GET /Act1/Actions/Action1234
Res: 4.04 Not Found
6.5. 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 14, line 15 skipping to change at page 21, line 5
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 Internet-DrafReusable Interface Definitions for Constrained October 2015
6.6. 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 set (PUT). Plain text or SenML Media types MAY can be read (GET) or update (PUT). Plain text or SenML Media types
be returned from this type of interface. MAY be returned from this type of interface.
The following example shows request for reading and setting 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 6.7. 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 set. Plain text or SenML Media types MAY be be read (GET) but not updated. Plain text or SenML Media types MAY
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 6.8. 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 a new actuator value set (PUT). In the actuator can be read (GET) or the actuator value can be updated
addition, this interface defines the use of POST (with no body) to (PUT). In addition, this interface allows the use of POST to change
toggle an actuator between its possible values. Plain text or SenML the state of an actuator, for example to toggle between its possible
Media types MAY be returned from this type of interface. A resource values. Plain text or SenML Media types MAY be returned from this
with this interface MAY use SenML to include multiple measurements in type of interface. A resource with this interface MAY use SenML to
the same representation, for example a list of recent actuator values include multiple measurements in the same representation, for example
or a list of values to set. a list of recent actuator values or a list of values to updated.
Internet-DrafReusable Interface Definitions for Constrained October 2015
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. Binding 6.9. Binding
The Binding interface is used to manipulate a binding table. A The Binding interface is used to manipulate a binding table. A
request with a POST method and a content type of application/ request with a POST method and a content format of application/link-
link-format simply appends new bindings to the table. All links in format simply appends new bindings to the table. All links in the
the payload MUST have a relation type "boundTo". A GET request payload MUST have a relation type "boundTo". A GET request simply
simply returns the current state of a binding table whereas a DELETE returns the current state of a binding table whereas a DELETE request
request empties the table. empties the table.
The following example shows requests for adding, retrieving and The following example shows requests for adding, retrieving and
deleting bindings in a binding table. deleting bindings in a binding table.
Req: POST /bnd (Content-type: application/link-format) Req: POST /bnd/ (Content-Format: application/link-format)
<coap://sensor.example.com/s/light>; <coap://sensor.example.com/s/light>;
rel="boundto";anchor="/a/light";bind="obs";pmin="10";pmax="60" rel="boundto";anchor="/a/light";bind="obs";pmin="10";pmax="60"
Res: 2.04 Changed Res: 2.04 Changed
Req: GET /bnd Req: GET /bnd/
Res: 2.05 Content (application/link-format) Res: 2.05 Content (application/link-format)
<coap://sensor.example.com/s/light>; <coap://sensor.example.com/s/light>;
rel="boundto";anchor="/a/light";bind="obs";pmin="10";pmax="60" rel="boundto";anchor="/a/light";bind="obs";pmin="10";pmax="60"
Req: DELETE /bnd Req: DELETE /bnd/
Res: 2.04 Changed Res: 2.04 Changed
5.9. Resource Observation Attributes Internet-DrafReusable Interface Definitions for Constrained October 2015
When resource interfaces following this specification are made 6.10. Future Interfaces
available over CoAP, the CoAP Observation mechanism
[I-D.ietf-core-observe] MAY be used to observe any changes in a
resource, and receive asynchronous notifications as a result. In
addition, a set of query string parameters are defined here to allow
a client to control how often a client is interested in receiving
notifications and how much a resource value should change for the new
representation to be interesting. These query parameters are
described in the following table. A resource using an interface
description defined in this specification and marked as Observable in
its link description SHOULD support these observation parameters.
The Change Step parameter can only be supported on resources with an
atomic numeric value.
These query parameters MUST be treated as resources that are read It is expected that further interface descriptions will be defined in
using GET and set using PUT, and MUST NOT be included in the Observe this and other specifications.
request. Multiple parameters MAY be set at the same time by
including the values in the query string of a PUT. Before being set,
these parameters have no default value.
+----------------+------------------+------------------+ 6.11. WADL Description
| Resource | Parameter | Data Format |
+----------------+------------------+------------------+
| Minimum Period | /{resource}?pmin | xsd:integer (>0) |
| Maximum Period | /{resource}?pmax | xsd:integer (>0) |
| Change Step | /{resource}?st | xsd:decimal (>0) |
| Less Than | /{resource}?lt | xsd:decimal |
| Greater Than | /{resource}?gt | xsd:decimal |
+----------------+------------------+------------------+
Minimum Period: When present, the minimum period indicates the This section defines the formal Web Application Description Langauge
minimum time to wait (in seconds) before sending a new (WADL) definition of these CoRE interface descriptions.
synchronization message (even if it has changed). In the absence
of this parameter, the minimum period is up to the notifier.
Maximum Period: When present, the maximum period indicates the <?xml version="1.0" standalone="yes"?>
maximum time in seconds between two consecutive syncronization
messages (regardless if it has changed). In the absence of this
parameter, the maximum period is up to the notifier. The maximum
period MUST be greater than the minimum period parameter (if
present).
Change Step: When present, the change step indicates how much the <application xmlns="http://research.sun.com/wadl/2006/10"
value of a resource SHOULD change before sending a new xmlns:xsd="http://www.w3.org/2001/XMLSchema"
notification (compared to the value of the last notification). xmlns:senml="urn:ietf:params:xml:ns:senml">
This parameter has lower priority than the period parameters, thus
even if the change step has been fulfilled, the time since the
last notification SHOULD be between pmin and pmax.
Greater Than: When present, Greater Than indicates the upper limit <grammars>
value the resource value SHOULD cross before sending a new <include href="http://tools.ietf.org/html/draft-jennings-senml"/>
notification. This parameter has lower priority than the period </grammars>
parameters, thus even if the Greater Than limit has been crossed,
the time since the last notification SHOULD be between pmin and
pmax.
Less Than: When present, Less Than indicates the lower limit value <doc title="CoRE Interfaces"/>
the resource value SHOULD cross before sending a new notification.
This parameter has lower priority than the period parameters, thus
even if the Less Than limit has been crossed, the time since the
last notification SHOULD be between pmin and pmax.
5.10. Future Interfaces <resource_type id="s">
<doc title="Sensor interface type"/>
<method href="#read"/>
<method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
</resource_type>
It is expected that further interface descriptions will be defined in <resource_type id="p">
this and other specifications. Potential interfaces to be considered <doc title="Parameter interfacee type"/>
for this specifications include: <method href="#read"/>
<method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
<method href="#update"/>
</resource_type>
Collection: This resource would be a container that allows sub- <resource_type id="rp">
resources to be added or removed. <doc title="Read-only Parameter interface type"/>
<method href="#read"/>
<method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
5.11. WADL Description Internet-DrafReusable Interface Definitions for Constrained October 2015
This section defines the formal Web Application Description Langauge <method href="#setattr"/>
(WADL) definition of these CoRE interface descriptions. </resource_type>
<?xml version="1.0" standalone="yes"?> <resource_type id="a">
<application xmlns="http://research.sun.com/wadl/2006/10" <doc title="Actuator interface type"/>
xmlns:xsd="http://www.w3.org/2001/XMLSchema" <method href="#read"/>
xmlns:senml="urn:ietf:params:xml:ns:senml"> <method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
<method href="#update"/>
<method href="#apply"/>
</resource_type>
<grammars> <resource_type id="ll">
<include href="http://tools.ietf.org/html/draft-jennings-senml"/> <doc title="Link List interface type"/></doc>
</grammars> <method href="#listLinks"/>
</resource_type>
<doc title="CoRE Interfaces"/> <resource_type id="b">
<doc title="Batch of sub-resources interface type">The methods read,
observe, update and apply are applied to each sub-
resource of the requested resource that supports it. Mixed
sub-resource types can be supported.</doc>
<method href="#read"/>
<method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
<method href="#update"/>
<method href="#apply"/>
<method href="#listLinks"/>
</resource_type>
<resource_type id="s"> <resource_type id="lb">
<doc title="Sensor resource type"/> <doc title="Linked Batch interface type">. The methods read,
<method href="#read"/> obervableRead, update and apply are applied to each linked
<method href="#observe"/> resource of the requested resource that supports it. Mixed
<method href="#observe-cancel"/> linked resource types can be supported.</doc>
<method href="#getattr"/> <method href="#read"/>
<method href="#setattr"/> <method href="#observe"/>
</resource_type> <method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
<method href="#update"/>
<method href="#apply"/>
<method href="#listLinks"/>
<method href="#appendLinks"/>
<resource_type id="p"> Internet-DrafReusable Interface Definitions for Constrained October 2015
<doc title="Parameter resource type"/>
<method href="#read"/>
<method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
<method href="#update"/>
</resource_type>
<resource_type id="rp"> <method href="#clearLinks"/>
<doc title="Read-only Parameter resource type"/> </resource_type>
<method href="#read"/>
<method href="#observe"/>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
</resource_type>
<resource_type id="a"> <resource_type id="hc">
<doc title="Actuator resource type"/> <doc title="Hypermedia Collection interface type">.</doc>
<method href="#read"/> <method href="#read"/>
<method href="#observe"/> <method href="#observe"/>
<method href="#observe-cancel"/> <method href="#observe-cancel"/>
<method href="#getattr"/> <method href="#getattr"/>
<method href="#setattr"/> <method href="#setattr"/>
<method href="#update"/> <method href="#update"/>
<method href="#toggle"/> <method href="#apply"/>
</resource_type> <method href="#listLinks"/>
<resource_type id="ll"> <method href="#appendLinks"/>
<doc title="Link List type"/></doc> <method href="#clearLinks"/>
<method href="#listLinks"/> <method href="#updateLinks"/>
</resource_type> <method href="#readCollection"/>
<method href="#addItem"/>
</resource_type>
<resource_type id="b"> <resource_type id="bnd">
<doc title="Batch of sub-resources type">The methods read, <doc title="Binding table resource type">A modifiable list of
observe, update and toggle are applied to each sub- links. Each link MUST have the relation type "boundTo".</doc>
resource of the requested resource that supports it. Mixed <method href="#listLinks"/>
sub-resource types can be supported.</doc> <method href="#appendLinks"/>
<method href="#read"/> <method href="#clearLinks"/>
<method href="#observe"/> </resource_type>
<method href="#observe-cancel"/>
<method href="#getattr"/>
<method href="#setattr"/>
<method href="#update"/>
<method href="#toggle"/>
<method href="#listLinks"/>
</resource_type>
<resource_type id="lb"> <method id="read" name="GET">
<doc title="Linked Batch resource type">. The methods read, <doc>Retrieve the value of a sensor, an actuator or a parameter.
obervableRead, update and toggle are applied to each linked Both HTTP and CoAP support this method.</doc>
resource of the requested resource that supports it. Mixed <request>
linked resource types can be supported.</doc> </request>
<method href="#read"/> <response status="200">
<method href="#observe"/> <representation mediaType="text/plain"/>
<method href="#observe-cancel"/> <representation mediaType="application/senml+exi"/>
<method href="#getattr"/> <representation mediaType="application/senml+xml"/>
<method href="#setattr"/> <representation mediaType="application/senml+json"/>
<method href="#update"/> </response>
<method href="#listLinks"/> <response status="2.05">
<method href="#appendLinks"/> <representation mediaType="text/plain"/>
<method href="#clearLinks"/>
</resource_type>
<resource_type id="bnd"> <representation mediaType="application/senml+exi"/>
<doc title="Binding table resource type">A modifiable list of <representation mediaType="application/senml+xml"/>
links. Each link MUST have the relation type "boundTo".</doc> <representation mediaType="application/senml+json"/>
<method href="#listLinks"/> </response>
<method href="#appendLinks"/> </method>
<method href="#clearLinks"/>
</resource_type>
<method id="read" name="GET"> Internet-DrafReusable Interface Definitions for Constrained October 2015
<doc>Retrieve the value of a sensor, an actuator or a parameter.
<method id="observe" name="GET">
<doc>Observe the value of a sensor, an actuator or a parameter.
Only CoAP supports this method since it requires the CoRE
Observe mechanism.</doc>
<request>
<param name="observe" style="header" type="xsd:integer">
<option value = 0/>
</param>
</request>
<response status="2.05">
<representation mediaType="text/plain"/>
<representation mediaType="application/senml+exi"/>
<representation mediaType="application/senml+xml"/>
<representation mediaType="application/senml+json"/>
</response>
</method>
<method id="observe-cancel" name="GET">
<doc>Cancel observation in progress.
Only CoAP supports this method since it requires the CoRE
Observe mechanism.</doc>
<request>
<param name="observe" style="header" type="xsd:integer">
<option value = 1/>
</param>
</request>
<response status="2.05">
<representation mediaType="text/plain"/>
<representation mediaType="application/senml+exi"/>
<representation mediaType="application/senml+xml"/>
<representation mediaType="application/senml+json"/>
</response>
</method>
<method id="update" name="PUT">
<doc>Control the actuator or update a parameter with a new value
or command. Both HTTP and CoAP support this method.</doc>
<request>
<representation mediaType="text/plain"/>
<representation mediaType="application/senml+exi"/>
<representation mediaType="application/senml+xml"/>
<representation mediaType="application/senml+json"/>
</request>
<response status="200"/>
<response status="2.04"/>
</method>
<method id="getattr" name="GET">
Internet-DrafReusable Interface Definitions for Constrained October 2015
<doc>Retrieve the observe attributes associated with a resource.
Both HTTP and CoAP support this method.</doc> Both HTTP and CoAP support this method.</doc>
<request> <request>
</request> <doc>This request MUST contain an Accept option with
<response status="200"> application/link-format when the resource supports
<representation mediaType="text/plain"/> other GET methods.</doc>
<representation mediaType="application/senml+exi"/> <representation mediaType="application/link-format"/>
<representation mediaType="application/senml+xml"/> </request>
<representation mediaType="application/senml+json"/> <response status="200">
</response> <representation mediaType="application/link-format"/>
<response status="2.05"> </response>
<representation mediaType="text/plain"/> <response status="2.05">
<representation mediaType="application/link-format"/>
</response>
</method>
<representation mediaType="application/senml+exi"/> <method id="setattr" name="PUT">
<representation mediaType="application/senml+xml"/> <doc>Set the values of some or all of the observe attributes
<representation mediaType="application/senml+json"/> associated with a resource.
</response> Both HTTP and CoAP support this method.</doc>
</method> <request>
<param name="pmin" style="query" type="xsd:integer"/>
<param name="pmax" style="query" type="xsd:integer"/>
<param name="lt" style="query" type="xsd:decimal"/>
<param name="gt" style="query" type="xsd:decimal"/>
<param name="st" style="query" type="xsd:decimal"/>
</request>
<response status="200">
</response>
<response status="2.04">
</response>
</method>
<method id="observe" name="GET"> <method id="apply" name="POST">
<doc>Observe the value of a sensor, an actuator or a parameter. <doc>Apply the value, if supplied, to resources. Both HTTP and CoAP
Only CoAP supports this method since it requires the CoRE support this method.</doc>
Observe mechanism.</doc> <request>
<request> <doc>The apply function may contain a payload to be applied.</doc>
<param name="observe" style="header" type="xsd:integer"> </request>
<option value = 0/> <response status="200"/>
</param> <response status="2.04"/>
</request> </method>
<response status="2.05">
<representation mediaType="text/plain"/>
<representation mediaType="application/senml+exi"/>
<representation mediaType="application/senml+xml"/>
<representation mediaType="application/senml+json"/>
</response>
</method>
<method id="observe-cancel" name="GET"> <method id="listLinks" name="GET">
<doc>Cancel observation in progress. <doc>Retrieve the list of Web links associated to a resource.
Only CoAP supports this method since it requires the CoRE Both HTTP and CoAP support this method.</doc>
Observe mechanism.</doc> <request>
<request> <doc>This request MUST contain an Accept option with
<param name="observe" style="header" type="xsd:integer">
<option value = 1/>
</param>
</request>
<response status="2.05">
<representation mediaType="text/plain"/>
<representation mediaType="application/senml+exi"/>
<representation mediaType="application/senml+xml"/>
<representation mediaType="application/senml+json"/>
</response>
</method> Internet-DrafReusable Interface Definitions for Constrained October 2015
<method id="update" name="PUT"> application/link-format when the resource supports
<doc>Control the actuator or update a parameter with a new value other GET methods.</doc>
or command. Both HTTP and CoAP support this method.</doc> </request>
<request> <response status="200">
<representation mediaType="text/plain"/> <representation mediaType="application/link-format"/>
<representation mediaType="application/senml+exi"/> </response>
<representation mediaType="application/senml+xml"/> <response status="2.05">
<representation mediaType="application/senml+json"/> <representation mediaType="application/link-format"/>
</request> </response>
<response status="200"/> </method>
<response status="2.04"/>
</method>
<method id="getattr" name="GET"> <method id="appendLinks" name="POST">
<doc>Retrieve the observe attributes associated with a resource. <doc>Append new Web links to a resource which is a collection
Both HTTP and CoAP support this method.</doc> of links. Both HTTP and CoAP support this method.</doc>
<request> <request>
<doc>This request MUST contain an Accept option with <representation mediaType="application/link-format"/>
application/link-format when the resource supports </request>
other GET methods.</doc> <response status="200"/>
<representation mediaType="application/link-format"/> <response status="2.04"/>
</request> </method>
<response status="200">
<representation mediaType="application/link-format"/>
</response>
<response status="2.05">
<representation mediaType="application/link-format"/>
</response>
</method>
<method id="setattr" name="PUT"> <method id="clearLinks" name="DELETE">
<doc>Set the values of some or all of the observe attributes <doc>Clear all Web Links in a resource which is a collection
associated with a resource. of links. Both HTTP and CoAP support this method.</doc>
Both HTTP and CoAP support this method.</doc> <request>
<request> </request>
<param name="pmin" style="query" type="xsd:integer"/> <response status="200"/>
<param name="pmax" style="query" type="xsd:integer"/> <response status="2.02"/>
<param name="lt" style="query" type="xsd:decimal"/> </method>
<param name="gt" style="query" type="xsd:decimal"/>
<param name="st" style="query" type="xsd:decimal"/>
</request>
<response status="200">
</response>
<response status="2.04">
</response>
</method>
<method id="toggle" name="POST">
<doc>Toggle the values of actuator resources. Both HTTP and CoAP
support this method.</doc>
<request>
<doc>The toggle function is only applicable if the request
is empty.</doc>
</request>
<response status="200"/>
<response status="2.04"/>
</method>
<method id="listLinks" name="GET"> <method id="updateLinks" name="PATCH">
<doc>Retrieve the list of Web links associated to a resource. <doc>Update all Web Links in a resource which is a collection
Both HTTP and CoAP support this method.</doc> of links. Both HTTP and CoAP support this method.</doc>
<request> <doc>This request MUST contain a Content-Format option with
<doc>This request MUST contain an Accept option with application/merge-patch+json.</doc>
application/link-format when the resource supports <request>
other GET methods.</doc> </request>
</request> <response status="200"/>
<response status="200"> <response status="2.04"/>
<representation mediaType="application/link-format"/> </method>
</response>
<response status="2.05">
<representation mediaType="application/link-format"/>
</response>
</method>
<method id="appendLinks" name="POST"> <method id="addItem" name="POST">
<doc>Append new Web links to a resource which is a collection <doc>Add zero or more items to the collection with their links. Both HTTP and CoAP support this method.</doc>
of links. Both HTTP and CoAP support this method.</doc> <doc>This request MAY contain a Content-Format option with
<request> application/collection+senml+json.</doc>
<representation mediaType="application/link-format"/> <doc>This request MAY contain a Content-Format option with
</request> application/senml+json.</doc>
<response status="200"/> <request>
<response status="2.04"/>
</method>
<method id="clearLinks" name="DELETE"> Internet-DrafReusable Interface Definitions for Constrained October 2015
<doc>Clear all Web Links in a resource which is a collection
of links. Both HTTP and CoAP support this method.</doc>
<request>
</request>
<response status="200"/>
<response status="2.04"/>
</method>
</application> </request>
<response status="200"/>
<response status="2.01"/>
</method>
6. Security Considerations <method id="readCollection" name="GET">
<doc>REturn a representation of both links and items in the collection. Both HTTP and CoAP support this method.</doc>
<doc>This request MUST contain an Accepts option with
application/collection+senml+json.</doc>
<request>
</request>
<response status="200"/>
<response status="2.05"/>
</method>
</application>
7. Function Sets and Profiles
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
in the sense that it consists of input, output and parameter
resources and contains internal logic. A Function Set can have a
subset of mandatory inputs, outputs and parameters to provide minimum
interoperability. It can also be extended with manufacturer/user-
specific resources. A device is composed of one or more Function Set
instances.
An example of function sets can be found from the CoRE Resource
Directory specification that defines REST interfaces for
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.
7.1. Defining a Function Set
In a Function Set, types of resources are defined. Each type
includes a human readable name, a path template, a Resource Type for
discovery, the Interface Definition and the data type and allowed
values. A Function Set definition may also include a field
indicating if a sub-resource is mandatory or optional.
Internet-DrafReusable Interface Definitions for Constrained October 2015
7.1.1. Path template
A Function Set is a container resource under which its sub-resources
are organized. The profile defines the path to each resource of a
Function Set in a path template. The template can contain either
relative paths or absolute paths depending on the profile needs. An
absolute Function Set should be located at its recommended root path
on a web server, however it can be located under an alternative path
if necessary (for example multi-purpose devices, gateways etc.). A
relative Function Set can be instantiated as many times as needed on
a web server with an arbitrary root path. However some Function Sets
(e.g. device description) only make sense as singletons.
The path template includes a possible index {#} parameter, and
possible fixed path segments. The index {#} allows for multiple
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
template. All other path segments should be fixed.
7.1.2. Resource Type
Each root resource of a Function Set is assigned a Resource Type
parameter, therefore making it possible to discover it. Each sub-
resource of a Function Set is also assigned a Resource Type
parameter. This Resource Type is used for resource discovery and is
usually necessary to discover optional resources supported on a
specific device. The Resource Type of a Function Set may also be
used for service discovery and can be exported to DNS-SD [RFC6763]
for example.
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
this resource. The value SHOULD be in the form "namespace.type" for
root resources and "namespace.type.subtype" for sub-resources. This
naming convention facilitates resource type filtering with the
/.well-known/core resource. However a profile could allow mixing in
foreign namespace references within a Function Set to import external
references from other object models (e.g. SenML and UCUM).
7.1.3. Interface Description
The Interface Description parameter defines the REST interface for
that type of resource. Several base interfaces are defined in
Section 6 of this document. For a given profile, the Interface
Description may be inferred from the Resource Type. In that case the
Interface Description MAY be elided from link descriptions of
resource types defined in the profile, but should be included for
custom extensions to the profile.
Internet-DrafReusable Interface Definitions for Constrained October 2015
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
CoRE Link List interface defined in Section 6.1 offers this
functionality so a root resource should support this interface or a
derived interface like CoRE Batch (See Section 6.2).
7.1.4. Data type
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
with a PUT. The interfaces defined in Section 6 make use of plain
text and SenML Media types for the actual format of this data. A
profile may restrict the list of supported content formats for the
CoRE interfaces or define new interfaces with new content types.
7.2. Discovery
A device conforming to a profile SHOULD make its resources
discoverable by providing links to the resources on the path /.well-
known/core as defined in [RFC6690]. All resources hosted on a device
SHOULD be discoverable either with a direct link in /.well-known/core
or by following successive links starting from /.well-known/core.
The root path of a Function Set instance SHOULD be directly
referenced in /.well-known/core in order to offer discovery at the
first discovery stage. A device with more than 10 individual
resources SHOULD only expose Function Set instances in /.well-known/
core to limit the size of this resource.
In addition, a device MAY register its resources to a Resource
Directory using the registration interface defined in
[I-D.ietf-core-resource-directory] if such a directory is available.
7.3. Versioning
A profile should track Function Set changes to avoid incompatibility
issues. Evolutions in a Function Set SHOULD be backward compatible.
8. 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.
7. IANA Considerations Internet-DrafReusable Interface Definitions for Constrained October 2015
9. IANA Considerations
The interface description types defined require registration. The interface description types defined require registration.
The new link relation type "boundto" requires registration. The new link relations type "boundto" and "grp" require registration.
8. Acknowledgments 10. Acknowledgments
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 types have been discussed, and to Szymon
Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann who have Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann who have
provided useful discussion and input to the concepts in this provided useful discussion and input to the concepts in this
document. document.
9. Changelog 11. Changelog
Changes from -03 to -04
o Fixed tickets #385 and #386
o Changed abstract and into to better describe content
o Focus on Interface and not function set/profiles in intro
o Changed references from draft-core-observe to RFC7641
o Moved Function sets and Profiles to section after Interfaces
o Moved Observe Attributes to the Link Binding section
o Add a Collection section to describe the collection types
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.
Internet-DrafReusable Interface Definitions for Constrained October 2015
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]
skipping to change at page 24, line 47 skipping to change at page 34, line 5
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.
10. References Internet-DrafReusable Interface Definitions for Constrained October 2015
10.1. Normative References
12. References
12.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, March 1997. Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
[RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. [RFC5988] Nottingham, M., "Web Linking", RFC 5988,
DOI 10.17487/RFC5988, October 2010,
<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, August 2012. Format", RFC 6690, DOI 10.17487/RFC6690, August 2012,
<http://www.rfc-editor.org/info/rfc6690>.
10.2. Informative References
[I-D.ietf-core-observe] 12.2. Informative References
Hartke, K., "Observing Resources in CoAP",
draft-ietf-core-observe-16 (work in progress),
December 2014.
[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-03 Resource Directory", draft-ietf-core-resource-directory-04
(work in progress), June 2015. (work in progress), July 2015.
[I-D.jennings-core-senml]
Jennings, C., Shelby, Z., Arkko, J., and A. Keranen,
"Media Types for Sensor Markup Language (SENML)", draft-
jennings-core-senml-01 (work in progress), July 2015.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, DOI 10.17487/RFC3986, January 2005,
<http://www.rfc-editor.org/info/rfc3986>.
[RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service
Discovery", RFC 6763, February 2013. Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013,
<http://www.rfc-editor.org/info/rfc6763>.
[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, June 2014. Application Protocol (CoAP)", RFC 7252,
DOI 10.17487/RFC7252, June 2014,
<http://www.rfc-editor.org/info/rfc7252>.
[RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396,
DOI 10.17487/RFC7396, October 2014,
<http://www.rfc-editor.org/info/rfc7396>.
Internet-DrafReusable Interface Definitions for Constrained October 2015
[RFC7641] Hartke, K., "Observing Resources in the Constrained
Application Protocol (CoAP)", RFC 7641,
DOI 10.17487/RFC7641, September 2015,
<http://www.rfc-editor.org/info/rfc7641>.
Appendix A. Profile example Appendix A. 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 |
skipping to change at page 26, line 27 skipping to change at page 36, line 5
| 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 Sensors Function Set
Internet-DrafReusable Interface Definitions for Constrained October 2015
+------+------------+----------------+--------+-------------+ +------+------------+----------------+--------+-------------+
| 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 Actuators Function Set
Authors' Addresses Authors' Addresses
skipping to change at page 27, line 4 skipping to change at page 36, line 25
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
Schneider-Electric Schneider-Electric
Grenoble, Grenoble
FRANCE FRANCE
Phone: +33 (0)47657 6522 Phone: +33 (0)47657 6522
Email: matthieu.vial@schneider-electric.com Email: matthieu.vial@schneider-electric.com
Michael Koster Michael Koster
ARM ARM
150 Rose Orchard 150 Rose Orchard
San Jose 95134 San Jose 95134
FINLAND USA
Phone:
Email: michael.koster@arm.com Email: michael.koster@arm.com
 End of changes. 143 change blocks. 
588 lines changed or deleted 1113 lines changed or added

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