idnits 2.17.1 draft-ietf-core-interfaces-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([RFC6690]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 13, 2017) is 2601 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- ** Obsolete normative reference: RFC 5988 (Obsoleted by RFC 8288) == Outdated reference: A later version (-14) exists of draft-ietf-core-dynlink-02 == Outdated reference: A later version (-28) exists of draft-ietf-core-resource-directory-10 == Outdated reference: A later version (-16) exists of draft-ietf-core-senml-05 -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Working Group Z. Shelby 3 Internet-Draft ARM 4 Intended status: Informational Z. Vial 5 Expires: September 14, 2017 Schneider-Electric 6 M. Koster 7 SmartThings 8 C. Groves 9 Huawei 10 March 13, 2017 12 Reusable Interface Definitions for Constrained RESTful Environments 13 draft-ietf-core-interfaces-09 15 Abstract 17 This document defines a set of Constrained RESTful Environments 18 (CoRE) Link Format Interface Descriptions [RFC6690] applicable for 19 use in constrained environments. These include the: Actuator, 20 Paramter, Read-only parameter, Sensor, Batch, Linked Batch and Link 21 List interfaces. 23 The Batch, Linked Batch and Link List interfaces make use of resource 24 collections. This document further describes how collections relate 25 to interfaces. 27 Many applications require a set of interface descriptions in order 28 provide the required functionality. This document defines the 29 concept of function sets to specify this set of interfaces and 30 resources. 32 _Editor's note: The git repository for the draft is found at 33 https://github.com/core-wg/interfaces_ 35 _Editor's note: Two open issues are proposals for: Removing the 36 binding interface in favour of the link list interface. Changing 37 "rel" type from one attribute to two to indicate src and 38 destination._ 40 Status of This Memo 42 This Internet-Draft is submitted in full conformance with the 43 provisions of BCP 78 and BCP 79. 45 Internet-Drafts are working documents of the Internet Engineering 46 Task Force (IETF). Note that other groups may also distribute 47 working documents as Internet-Drafts. The list of current Internet- 48 Drafts is at http://datatracker.ietf.org/drafts/current/. 50 Internet-Drafts are draft documents valid for a maximum of six months 51 and may be updated, replaced, or obsoleted by other documents at any 52 time. It is inappropriate to use Internet-Drafts as reference 53 material or to cite them other than as "work in progress." 55 This Internet-Draft will expire on September 14, 2017. 57 Copyright Notice 59 Copyright (c) 2017 IETF Trust and the persons identified as the 60 document authors. All rights reserved. 62 This document is subject to BCP 78 and the IETF Trust's Legal 63 Provisions Relating to IETF Documents 64 (http://trustee.ietf.org/license-info) in effect on the date of 65 publication of this document. Please review these documents 66 carefully, as they describe your rights and restrictions with respect 67 to this document. Code Components extracted from this document must 68 include Simplified BSD License text as described in Section 4.e of 69 the Trust Legal Provisions and are provided without warranty as 70 described in the Simplified BSD License. 72 Table of Contents 74 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 75 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 76 3. Collections . . . . . . . . . . . . . . . . . . . . . . . . . 5 77 3.1. Introduction to Collections . . . . . . . . . . . . . . . 5 78 3.2. Use Cases for Collections . . . . . . . . . . . . . . . . 6 79 3.3. Content-Formats for Collections . . . . . . . . . . . . . 6 80 3.4. Links and Items in Collections . . . . . . . . . . . . . 7 81 3.5. Queries on Collections . . . . . . . . . . . . . . . . . 8 82 3.6. Observing Collections . . . . . . . . . . . . . . . . . . 8 83 3.7. Collection Types . . . . . . . . . . . . . . . . . . . . 8 84 4. Interface Descriptions . . . . . . . . . . . . . . . . . . . 9 85 4.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 11 86 4.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 11 87 4.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 12 88 4.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 13 89 4.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 14 90 4.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 14 91 4.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 14 92 5. Security Considerations . . . . . . . . . . . . . . . . . . . 15 93 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 94 6.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 15 95 6.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 16 96 6.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 16 97 6.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 16 98 6.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 16 99 6.6. Read-only parameter . . . . . . . . . . . . . . . . . . . 17 100 6.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 17 101 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17 102 8. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 18 103 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 104 9.1. Normative References . . . . . . . . . . . . . . . . . . 21 105 9.2. Informative References . . . . . . . . . . . . . . . . . 21 106 Appendix A. Current Usage of Interfaces and Function Sets . . . 22 107 A.1. Constrained RESTful Environments (CoRE) Link Format 108 (IETF) . . . . . . . . . . . . . . . . . . . . . . . . . 23 109 A.2. CoRE Resource Directory (IETF) . . . . . . . . . . . . . 23 110 A.3. Open Connectivity Foundation (OCF) . . . . . . . . . . . 23 111 A.4. oneM2M . . . . . . . . . . . . . . . . . . . . . . . . . 24 112 A.5. OMA LWM2M . . . . . . . . . . . . . . . . . . . . . . . . 24 113 Appendix B. Resource Profile example . . . . . . . . . . . . . . 25 114 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 116 1. Introduction 118 IETF Standards for machine to machine communication in constrained 119 environments describe a REST protocol and a set of related 120 information standards that may be used to represent machine data and 121 machine metadata in REST interfaces. CoRE Link-format is a standard 122 for doing Web Linking [RFC5988] in constrained environments. SenML 123 [I-D.ietf-core-senml] is a simple data model and representation 124 format for composite and complex structured resources. CoRE Link- 125 Format and SenML can be used by CoAP [RFC7252] or HTTP servers. 127 The discovery of resources offered by a constrained server is very 128 important in machine-to-machine applications where there are no 129 humans in the loop. Machine application clients must be able to 130 adapt to different resource organizations without advance knowledge 131 of the specific data structures hosted by each connected thing. The 132 use of Web Linking for the description and discovery of resources 133 hosted by constrained web servers is specified by CoRE Link Format 134 [RFC6690]. CoRE Link Format additionally defines a link attribute 135 for interface description ("if") that can be used to describe the 136 REST interface of a resource, and may include a link to a description 137 document. 139 This document defines a set of Link Format interface descriptions for 140 some common design patterns that enable the server side composition 141 and organization, and client side discovery and consumption, of 142 machine resources using Web Linking. A client discovering the "if" 143 link attribute will be able to consume resources based on its 144 knowledge of the expected interface types. In this sense the 145 Interface Type acts in a similar way as a Content-Format, but as a 146 selector for a high level functional abstraction. 148 An interface description describes a resource in terms of it's 149 associated content formats, data types, URI templates, REST methods, 150 parameters, and responses. Basic interface descriptions are defined 151 for sensors, actuators, and properties. 153 A set of collection types is defined for organizing resources for 154 discovery, and for various forms of bulk interaction with resource 155 sets using typed embedding links. 157 This document first defines the concept of collection interface 158 descriptions. It then defines a number of generic interface 159 descriptions that may be used in contrained environments. Several of 160 these interface descriptions utilise collections. 162 Whilst this document assumes the use of CoAP [RFC7252], the REST 163 interfaces described can also be realized using HTTP [RFC7230]. 165 2. Terminology 167 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 168 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 169 "OPTIONAL" in this document are to be interpreted as described in 170 [RFC2119]. 172 This document requires readers to be familiar with all the terms and 173 concepts that are discussed in [RFC5988] and [RFC6690]. This 174 document makes use of the following additional terminology: 176 Gradual Reveal: A REST design where resources are discovered 177 progressively using Web Linking. 179 Interface Description: The Interface Description describes the 180 generic REST interface to interact with a resource or a set of 181 resources. Its use is described via the Interface Description 182 'if' attribute which is an opaque string used to provide a name or 183 URI indicating a specific interface definition used to interact 184 with the target resource. One can think of this as describing 185 verbs usable on a resource. 187 Resource Discovery: The process allowing a web client to identify 188 resources being hosted on a web server. 190 Service Discovery: The process making it possible for a web client 191 to automatically detect devices and Function Sets offered by these 192 devices on a CoRE network. 194 3. Collections 196 3.1. Introduction to Collections 198 A Collection is a resource which represents one or more related 199 resources. [RFC6573] describes the "item" and "collection" Link 200 Relation. "item" link relation identifies a member of collection. 201 "collection" indicates the collection that an item is a member of. 202 For example: A collection might be a resource representing catalog of 203 products, an item is a resource related to an individual product. 205 Section 1.2.2/[RFC6690] also describes resource collections. 207 This document uses the concept of "collection" and applies it to 208 interface descriptions. A collection interface description consists 209 of a set of links and a set of items pointed to by the links which 210 may be sub-resources of the collection resource. The collection 211 interface descriptions described in this document are Link List, 212 Batch and Linked Batch. 214 The links in a collection are represented in CoRE Link-Format 215 Content-Formats including JSON and CBOR variants, and the items in 216 the collection may be represented by senml, including JSON and CBOR 217 variants. In general, a collection may support items of any 218 available Content-Format. 220 A particular resource item may be a member of more than one 221 collection at a time by being linked to, but may only be a 222 subresource of one collection. 224 Some collections may have pre-configured items and links, and some 225 collections may support dynamic creation and removal of items and 226 links. Likewise, modification of items in some collections may be 227 permitted, and not in others. 229 Collections may support link embedding, which is analogous to an 230 image tag (link) causing the image to display inline in a browser 231 window. Resources pointed to by embedded links in collections may be 232 interacted with using bulk operations on the collection resource. 233 For example, performing a GET on a collection resource may return a 234 single representation containing all of the linked resources. 236 Links in collections may be selected for processing by a particular 237 request by using Query Filtering as described in CoRE Link-Format 238 [RFC6690]. 240 3.2. Use Cases for Collections 242 Collections may be used to provide gradual reveal of resources on an 243 endpoint. There may be a small set of links at the .well-known/core 244 location, which may in turn point to other collections of resources 245 that represent device information, device configuration, device 246 management, and various functional clusters of resources on the 247 device. 249 A collection may provide resource encapsulation, where link embedding 250 may be used to provide a single resource with which a client may 251 interact to obtain a set of related resource values. For example, a 252 collection for manufacturer parameters may consist of manufacturer 253 name, date of manufacture, location of manufacture, and serial number 254 resources which can be read as a single senml data object. 256 A collection may be used to group a set of like resources for bulk 257 state update or actuation. For example, the brightness control 258 resources of a number of luminaries may be grouped by linking to them 259 in a collection. The collection type may support receiving a single 260 update form a client and sending that update to each resource item in 261 the collection. 263 Items may be sub-resources of the collection resource. This enables 264 updates to multiple items in the collection to be processed together 265 within the context of the collection resource. 267 3.3. Content-Formats for Collections 269 The collection interfaces by default use CoRE Link-Format for the 270 link representations and SenML or text/plain for representations of 271 items. The examples given are for collections that expose resources 272 and links in these formats. In addition, a new "collection" Content- 273 Format is defined based on the SenML framework which represents both 274 links and items in the collection. 276 The choice of whether to return a representation of the links or of 277 the items or of the collection format is determined by the Accept 278 header option in the request. Likewise, the choice of updating link 279 metadata or item data or the collection resource itself is determined 280 by the Content-Format option in the header of the update request 281 operation. 283 The default Content-Formats for collection types described in this 284 document are: 286 Links: application/link-format, application/link-format+json 287 Items: application/senml+json, text/plain 289 3.4. Links and Items in Collections 291 Links use CoRE Link-Format representation by default and may point to 292 any resource reachable from the context of the collection. This 293 includes absolute links and links that point to other network 294 locations if the context of the collection allows. Links to sub- 295 resources in the collection MUST have a path-element starting with 296 the resource name, as per [RFC3986]. Links to resources in the 297 global context MUST start with a root path identifier [RFC5988]. 298 Links to other collections are formed per [RFC3986]. 300 Examples of links: 302 ;if="core.lb"': Link to the /sen/ collection describing it as 303 a core.lb type collection (Linked Batch) 305 ;rel="grp"': Link to the /sen/ collection indicating that 306 /sen/ is a member of a group in the collection in which the link 307 appears. 309 <"/sen/temp">;rt="temperature"': An absolute link to the resource at 310 the path /sen/temp 312 ;rt="temperature": Link to the temp subresource of the 313 collection in which this link appears." 315 ;anchor="/sen/": A link to the temp subresource of the 316 collection /sen/ which is assumed not to be a subresource of the 317 collection in which the link appears ,but is expected to be 318 identified in the collection by resource name. 320 Links in the collection MAY be Read, Updated, Added, or Removed using 321 the CoRE Link-Format or JSON Merge-Patch Content-Formats on the 322 collection resource. Reading links uses the GET method and returns 323 an array or list containing the link-values of all selected links. 324 Links may be added to the collection using POST or PATCH methods. 325 Updates to links MUST use the PATCH method and MAY use query 326 filtering to select links for updating. The PATCH method on links 327 MUST use the JSON Merge-Patch Content-Format (application/merge- 328 patch+json) specified in [RFC7396]. 330 Items in the collection SHOULD be represented using the SenML 331 (application/senml+json) or plain text (text/plain) Content-Formats, 332 depending on whether the representation is of a single data point or 333 multiple data points. Items MAY be represented using any supported 334 Content-Format. 336 Link Embedding enables the bulk processing of items in the collection 337 using a single operation targeting the collection resource. A subset 338 of resources in the collection may be selected for operation using 339 Query Filtering. Bulk Read operations using GET return a SenML 340 representation of all selected resources. Bulk item Update 341 operations using PUT or POST apply the payload document to all 342 selected resource items in the collection, using either a Batch or 343 Group update policy. A Batch update is performed by applying the 344 resource values in the payload document to all resources in the 345 collection that match any resource name in the payload document. 346 Group updates are performed by applying the payload document to each 347 item in the collection. Group updates are indicated by the link 348 relation type rel="grp" in the link. 350 3.5. Queries on Collections 352 Collections MAY support query filtering as defined in CoRE Link- 353 Format [RFC6690]. Operations targeting either the links or the items 354 MAY select a subset of links and items in the collection by using 355 query filtering. The Content-Format specified in the request header 356 selects whether links or items are targeted by the operation. 358 3.6. Observing Collections 360 Resource Observation via [I-D.ietf-core-dynlink] using CoAP [RFC7252] 361 MAY be supported on items in a collection. A subset of the 362 conditional observe parameters MAY be specified to apply. In most 363 cases pmin and pmax are useful. Resource observation on a 364 collection's items resource returns the collection representation. 365 Observation Responses, or notifications, SHOULD provide the 366 collection representations in SenML Content-Format. Notifications 367 MAY include multiple observations of the colection resource, with 368 SenML time stamps indicating the observation times. 370 3.7. Collection Types 372 There are three collection types defined in this document: 374 +-----------------+---------+--------------------+ 375 | Collection Type | if= | Content-Format | 376 +-----------------+---------+--------------------+ 377 | Link List | core.ll | link-format | 378 | | | | 379 | Batch | core.b | link-format, senml | 380 | | | | 381 | Linked Batch | core.lb | link-format, senml | 382 +-----------------+---------+--------------------+ 384 Table 1: Collection Type Summary 386 The interface description defined in this document describes the 387 methods and functions that may be applied to the collections. 389 4. Interface Descriptions 391 This section defines REST interfaces for Link List, Batch, Sensor, 392 Parameter and Actuator resources. Variants such as Linked Batch or 393 Read-Only Parameter are also presented. Each type is described along 394 with its Interface Description attribute value and valid methods. 395 These are defined for each interface in the table below. These 396 interfaces can support plain text and/or SenML Media types. 398 The if= column defines the Interface Description (if=) attribute 399 value to be used in the CoRE Link Format for a resource conforming to 400 that interface. When this value appears in the if= attribute of a 401 link, the resource MUST support the corresponding REST interface 402 described in this section. The resource MAY support additional 403 functionality, which is out of scope for this document. Although 404 these interface descriptions are intended to be used with the CoRE 405 Link Format, they are applicable for use in any REST interface 406 definition. 408 The Methods column defines the methods supported by that interface, 409 which are described in more detail below. 411 +--------------+---------+-----------------+--------------------+ 412 | Interface | if= | Methods | Content-Formats | 413 +--------------+---------+-----------------+--------------------+ 414 | Link List | core.ll | GET | link-format | 415 | | | | | 416 | Batch | core.b | GET, PUT, POST | link-format, senml | 417 | | | | | 418 | Linked Batch | core.lb | GET, PUT, POST, | link-format, senml | 419 | | | | | 420 | | | DELETE | | 421 | | | | | 422 | Sensor | core.s | GET | link-format, | 423 | | | | | 424 | | | | text/plain | 425 | | | | | 426 | Parameter | core.p | GET, PUT | link-format, | 427 | | | | | 428 | | | | text/plain | 429 | | | | | 430 | Read-only | core.rp | GET | link-format, | 431 | | | | | 432 | Parameter | | | text/plain | 433 | | | | | 434 | Actuator | core.a | GET, PUT, POST | link-format, | 435 | | | | | 436 | | | | text/plain | 437 +--------------+---------+-----------------+--------------------+ 439 Table 2: Interface Description Summary 441 The following is an example of links in the CoRE Link Format using 442 these interface descriptions. The resource hierarchy is based on a 443 simple resource profile defined in Appendix B. These links are used 444 in the subsequent examples below. 446 Req: GET /.well-known/core 447 Res: 2.05 Content (application/link-format) 448 ;rt="simple.sen";if="core.b", 449 ;rt="simple.sen.lt";if="core.s", 450 ;rt="simple.sen.tmp";if="core.s";obs, 451 ;rt="simple.sen.hum";if="core.s", 452 ;rt="simple.act";if="core.b", 453 ;rt="simple.act.led";if="core.a", 454 ;rt="simple.act.led";if="core.a", 455 ;rt="simple.dev";if="core.ll", 456 ;if="core.lb", 458 Figure 1: Binding Interface Example 460 4.1. Link List 462 The Link List interface is used to retrieve (GET) a list of resources 463 on a web server. The GET request SHOULD contain an Accept option 464 with the application/link-format content format. However if the 465 resource does not support any other form of content-format the Accept 466 option MAY be elided. 468 Note: The use of an Accept option with application/link-format is 469 recommended even though it is not strictly needed for the link list 470 interface because this interface is extended by the batch and linked 471 batch interfaces where different content-formats are possible. 473 The request returns a list of URI references with absolute paths to 474 the resources as defined in CoRE Link Format. This interface is 475 typically used with a parent resource to enumerate sub-resources but 476 may be used to reference any resource on a web server. 478 Link List is the base interface to provide gradual reveal of 479 resources on a CoRE web server, hence the root resource of a Function 480 Set SHOULD implement this interface or an extension of this 481 interface. 483 The following example interacts with a Link List /d containing 484 Parameter sub-resources /d/name, /d/model. 486 Req: GET /d/ (Accept:application/link-format) 487 Res: 2.05 Content (application/link-format) 488 ;rt="simple.dev.n";if="core.p", 489 ;rt="simple.dev.mdl";if="core.rp" 491 4.2. Batch 493 The Batch interface is used to manipulate a collection of sub- 494 resources at the same time. The Batch interface description supports 495 the same methods as its sub-resources, and can be used to read (GET), 496 update (PUT) or apply (POST) the values of those sub-resource with a 497 single resource representation. The sub-resources of a Batch MAY be 498 heterogeneous, a method used on the Batch only applies to sub- 499 resources that support it. For example Sensor interfaces do not 500 support PUT, and thus a PUT request to a Sensor member of that Batch 501 would be ignored. A batch requires the use of SenML Media types in 502 order to support multiple sub-resources. 504 In addition, the Batch interface is an extension of the Link List 505 interface and in consequence MUST support the same methods. For 506 example: a GET with an Accept:application/link-format on a resource 507 utilizing the batch interface will return the sub-resource links. 509 The following example interacts with a Batch /s/ with Sensor sub- 510 resources /s/light, /s/temp and /s/humidity. 512 Req: GET /s/ 513 Res: 2.05 Content (application/senml+json) 514 {"e":[ 515 { "n": "light", "v": 123, "u": "lx" }, 516 { "n": "temp", "v": 27.2, "u": "degC" }, 517 { "n": "humidity", "v": 80, "u": "%RH" }], 518 } 520 4.3. Linked Batch 522 The Linked Batch interface is an extension of the Batch interface. 523 Contrary to the basic Batch which is a collection statically defined 524 by the web server, a Linked Batch is dynamically controlled by a web 525 client. A Linked Batch resource has no sub-resources. Instead the 526 resources forming the batch are referenced using Web Linking 527 [RFC5988] and the CoRE Link Format [RFC6690]. A request with a POST 528 method and a content format of application/link-format simply appends 529 new resource links to the collection. The links in the payload MUST 530 reference a resource on the web server with an absolute path. A 531 DELETE request removes the entire collection. All other requests 532 available for a basic Batch are still valid for a Linked Batch. 534 The following example interacts with a Linked Batch /l/ and creates a 535 collection containing /s/light, /s/temp and /s/humidity in 2 steps. 537 Req: POST /l/ (Content-Format: application/link-format) 538 , 539 Res: 2.04 Changed 541 Req: GET /l/ 542 Res: 2.05 Content (application/senml+json) 543 {"e":[ 544 { "n": "/s/light", "v": 123, "u": "lx" }, 545 { "n": "/s/temp", "v": 27.2, "u": "degC" }, 546 } 548 Req: POST /l/ (Content-Format: application/link-format) 549 550 Res: 2.04 Changed 552 Req: GET /l/ (Accept: application/link-format) 553 Res: 2.05 Content (application/link-format) 554 ,, 556 Req: GET /l/ 557 Res: 2.05 Content (application/senml+json) 558 {"e":[ 559 { "n": "/s/light", "v": 123, "u": "lx" }, 560 { "n": "/s/temp", "v": 27.2, "u": "degC" }, 561 { "n": "/s/humidity", "v": 80, "u": "%RH" }], 562 } 564 Req: DELETE /l/ 565 Res: 2.02 Deleted 567 4.4. Sensor 569 The Sensor interface allows the value of a sensor resource to be read 570 (GET). The Media type of the resource can be either plain text or 571 SenML. Plain text MAY be used for a single measurement that does not 572 require meta-data. For a measurement with meta-data such as a unit 573 or time stamp, SenML SHOULD be used. A resource with this interface 574 MAY use SenML to return multiple measurements in the same 575 representation, for example a list of recent measurements. 577 The following are examples of Sensor interface requests in both text/ 578 plain and application/senml+json. 580 Req: GET /s/humidity (Accept: text/plain) 581 Res: 2.05 Content (text/plain) 582 80 584 Req: GET /s/humidity (Accept: application/senml+json) 585 Res: 2.05 Content (application/senml+json) 586 {"e":[ 587 { "n": "humidity", "v": 80, "u": "%RH" }], 588 } 590 4.5. Parameter 592 The Parameter interface allows configurable parameters and other 593 information to be modeled as a resource. The value of the parameter 594 can be read (GET) or update (PUT). Plain text or SenML Media types 595 MAY be returned from this type of interface. 597 The following example shows request for reading and updating a 598 parameter. 600 Req: GET /d/name 601 Res: 2.05 Content (text/plain) 602 node5 604 Req: PUT /d/name (text/plain) 605 outdoor 606 Res: 2.04 Changed 608 4.6. Read-only Parameter 610 The Read-only Parameter interface allows configuration parameters to 611 be read (GET) but not updated. Plain text or SenML Media types MAY 612 be returned from this type of interface. 614 The following example shows request for reading such a parameter. 616 Req: GET /d/model 617 Res: 2.05 Content (text/plain) 618 SuperNode200 620 4.7. Actuator 622 The Actuator interface is used by resources that model different 623 kinds of actuators (changing its value has an effect on its 624 environment). Examples of actuators include for example LEDs, 625 relays, motor controllers and light dimmers. The current value of 626 the actuator can be read (GET) or the actuator value can be updated 627 (PUT). In addition, this interface allows the use of POST to change 628 the state of an actuator, for example to toggle between its possible 629 values. Plain text or SenML Media types MAY be returned from this 630 type of interface. A resource with this interface MAY use SenML to 631 include multiple measurements in the same representation, for example 632 a list of recent actuator values or a list of values to updated. 634 The following example shows requests for reading, setting and 635 toggling an actuator (turning on a LED). 637 Req: GET /a/1/led 638 Res: 2.05 Content (text/plain) 639 0 641 Req: PUT /a/1/led (text/plain) 642 1 643 Res: 2.04 Changed 645 Req: POST /a/1/led (text/plain) 646 Res: 2.04 Changed 648 Req: GET /a/1/led 649 Res: 2.05 Content (text/plain) 650 0 652 5. Security Considerations 654 An implementation of a client needs to be prepared to deal with 655 responses to a request that differ from what is specified in this 656 document. A server implementing what the client thinks is a resource 657 with one of these interface descriptions could return malformed 658 representations and response codes either by accident or maliciously. 659 A server sending maliciously malformed responses could attempt to 660 take advantage of a poorly implemented client for example to crash 661 the node or perform denial of service. 663 6. IANA Considerations 665 This document registers the following CoRE Interface Description 666 (if=) Link Target Attribute Values. 668 6.1. Link List 670 Attribute Value: core.ll 672 Description: The Link List interface is used to retrieve a list of 673 resources on a web server. 675 Reference: This document. Note to RFC Editor - please insert the 676 appropriate RFC reference. 678 Notes: None 680 6.2. Batch 682 Attribute Value: core.b 684 Description: The Batch interface is used to manipulate a collection 685 of sub-resources at the same time. 687 Reference: This document. Note to RFC Editor - please insert the 688 appropriate RFC reference. 690 Notes: None 692 6.3. Linked Batch 694 Attribute Value: core.lb 696 Description: The Linked Batch interface is an extension of the Batch 697 interface. Contrary to the basic Batch which is a collection 698 statically defined by the web server, a Linked Batch is 699 dynamically controlled by a web client. 701 Reference: This document. Note to RFC Editor - please insert the 702 appropriate RFC reference. 704 Notes: None 706 6.4. Sensor 708 Attribute Value: core.s 710 Description: The Sensor interface allows the value of a sensor 711 resource to be read. 713 Reference: This document. Note to RFC Editor - please insert the 714 appropriate RFC reference. 716 Notes: None 718 6.5. Parameter 720 Attribute Value: core.p 721 Description: The Parameter interface allows configurable parameters 722 and other information to be modeled as a resource. The value of 723 the parameter can be read or update. 725 Reference: This document. Note to RFC Editor - please insert the 726 appropriate RFC reference. 728 Notes: None 730 6.6. Read-only parameter 732 Attribute Value: core.rp 734 Description: The Read-only Parameter interface allows configuration 735 parameters to be read but not updated. 737 Reference: This document. Note to RFC Editor - please insert the 738 appropriate RFC reference. 740 Notes: None 742 6.7. Actuator 744 Attribute Value: core.a 746 Description: The Actuator interface is used by resources that model 747 different kinds of actuators (changing its value has an effect on 748 its environment). Examples of actuators include for example LEDs, 749 relays, motor controllers and light dimmers. The current value of 750 the actuator can be read or the actuator value can be updated. In 751 addition, this interface allows the use of POST to change the 752 state of an actuator, for example to toggle between its possible 753 values. 755 Reference: This document. Note to RFC Editor - please insert the 756 appropriate RFC reference. 758 Notes: None 760 7. Acknowledgements 762 Acknowledgement is given to colleagues from the SENSEI project who 763 were critical in the initial development of the well-known REST 764 interface concept, to members of the IPSO Alliance where further 765 requirements for interface descriptions have been discussed, and to 766 Szymon Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann 767 who have provided useful discussion and input to the concepts in this 768 document. 770 8. Changelog 772 Changes from -08 to 09: 774 o Section 3.6: Modified to indicate that the entire collection 775 resource is returned. 777 o General: Added editor's note with open issues. 779 Changes from -07 to 08: 781 o Section 3.3: Modified Accepts to Accept header option. 783 o Addressed the editor's note in Section 4.1 to clarify the use of 784 the Accept option. 786 Changes from -06 to 07: 788 o Corrected Figure 1 sub-resource names e.g. tmp to temp and hum to 789 humidity. 791 o Addressed the editor's note in Section 4.2. 793 o Removed section on function sets and profiles as agreed to at the 794 IETF#97. 796 Changes from -05 to -06: 798 o Updated the abstract. 800 o Section 1: Updated introduction. 802 o Section 2: Alphabetised the order 804 o Section 2: Removed the collections definition in favour of the 805 complete definition in the collections section. 807 o Removed section 3 on interfaces in favour of an updated definition 808 in section 1.3. 810 o General: Changed interface type to interface description as that 811 is the term defined in RFC6690. 813 o Removed section on future interfaces. 815 o Section 8: Updated IANA considerations. 817 o Added Appendix A to discuss current state of the art wrt to 818 collections, function sets etc. 820 Changes from -04 to -05: 822 o Removed Link Bindings and Observe attributes. This functionality 823 is now contained in I-D.ietf-core-dynlink. 825 o Hypermedia collections have been removed. This is covered in a 826 new T2TRG draft. 828 o The WADL description has been removed. 830 o Fixed minor typos. 832 o Updated references. 834 Changes from -03 to -04: 836 o Fixed tickets #385 and #386. 838 o Changed abstract and into to better describe content. 840 o Focus on Interface and not function set/profiles in intro. 842 o Changed references from draft-core-observe to RFC7641. 844 o Moved Function sets and Profiles to section after Interfaces. 846 o Moved Observe Attributes to the Link Binding section. 848 o Add a Collection section to describe the collection types. 850 o Add the Hypermedia Collection Interface Description. 852 Changes from -02 to -03: 854 o Added lt and gt to binding format section. 856 o Added pmin and pmax observe parameters to Observation Attributes. 858 o Changed the definition of lt and gt to limit crossing. 860 o Added definitions for getattr and setattr to WADL. 862 o Added getattr and setattr to observable interfaces. 864 o Removed query parameters from Observe definition. 866 o Added observe-cancel definition to WADL and to observable 867 interfaces. 869 Changes from -01 to -02: 871 o Updated the date and version, fixed references. 873 o "Removed pmin and pmax observe parameters "[Ticket #336]"." 875 Changes from -00 to WG Document -01 877 o Improvements to the Function Set section. 879 Changes from -05 to WG Document -00 881 o Updated the date and version. 883 Changes from -04 to -05 885 o Made the Observation control parameters to be treated as resources 886 rather than Observe query parameters. Added Less Than and Greater 887 Than parameters. 889 Changes from -03 to -04 891 o Draft refresh 893 Changes from -02 to -03 895 o Added Bindings 897 o Updated all rt= and if= for the new Link Format IANA rules 899 Changes from -01 to -02 901 o Defined a Function Set and its guidelines. 903 o Added the Link List interface. 905 o Added the Linked Batch interface. 907 o Improved the WADL interface definition. 909 o Added a simple profile example. 911 9. References 913 9.1. Normative References 915 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 916 Requirement Levels", BCP 14, RFC 2119, 917 DOI 10.17487/RFC2119, March 1997, 918 . 920 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 921 DOI 10.17487/RFC5988, October 2010, 922 . 924 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 925 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 926 . 928 9.2. Informative References 930 [I-D.ietf-core-dynlink] 931 Shelby, Z., Vial, M., Koster, M., and C. Groves, "Dynamic 932 Resource Linking for Constrained RESTful Environments", 933 draft-ietf-core-dynlink-02 (work in progress), February 934 2017. 936 [I-D.ietf-core-resource-directory] 937 Shelby, Z., Koster, M., Bormann, C., and P. Stok, "CoRE 938 Resource Directory", draft-ietf-core-resource-directory-10 939 (work in progress), March 2017. 941 [I-D.ietf-core-senml] 942 Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C. 943 Bormann, "Media Types for Sensor Measurement Lists 944 (SenML)", draft-ietf-core-senml-05 (work in progress), 945 March 2017. 947 [OIC-Core] 948 "OIC Resource Type Specification v1.1.0", 2016, 949 . 951 [OIC-SmartHome] 952 "OIC Smart Home Device Specification v1.1.0", 2016, 953 . 955 [OMA-TS-LWM2M] 956 "Lightweight Machine to Machine Technical Specification", 957 2016, . 961 [oneM2MTS0008] 962 "TS 0008 v1.3.2 CoAP Protocol Binding", 2016, 963 . 965 [oneM2MTS0023] 966 "TS 0023 v2.0.0 Home Appliances Information Model and 967 Mapping", 2016, 968 . 970 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 971 Resource Identifier (URI): Generic Syntax", STD 66, 972 RFC 3986, DOI 10.17487/RFC3986, January 2005, 973 . 975 [RFC6573] Amundsen, M., "The Item and Collection Link Relations", 976 RFC 6573, DOI 10.17487/RFC6573, April 2012, 977 . 979 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 980 Protocol (HTTP/1.1): Message Syntax and Routing", 981 RFC 7230, DOI 10.17487/RFC7230, June 2014, 982 . 984 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 985 Application Protocol (CoAP)", RFC 7252, 986 DOI 10.17487/RFC7252, June 2014, 987 . 989 [RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396, 990 DOI 10.17487/RFC7396, October 2014, 991 . 993 Appendix A. Current Usage of Interfaces and Function Sets 995 Editor's note: This appendix will be removed. It is only included 996 for information. 998 This appendix analyses the current landscape with regards the 999 definition and use of collections, interfaces and function sets/ 1000 profiles. This should be considered when considering the scope of 1001 this document. 1003 In summary it can be seen that there is a lack of consistancy of the 1004 definition and usage of interface description and function sets. 1006 A.1. Constrained RESTful Environments (CoRE) Link Format (IETF) 1008 [RFC6690] assumes that different deployments or application domains 1009 will define the appropriate REST Interface Descriptions along with 1010 Resource Types to make discovery meaningful. It highlights that 1011 collections are often used for these interfaces. 1013 Whilst 3.2/[RFC6690] defines a new Interface Description 'if' 1014 attribute the procedures around it are about the naming of the 1015 interface not what information should be included in the 1016 documentation about the interface. 1018 Function sets are not discussed. 1020 A.2. CoRE Resource Directory (IETF) 1022 [I-D.ietf-core-resource-directory] uses the concepts of collections, 1023 interfaces and function sets. 1025 If defines a number of interfaces: discovery, registration, 1026 registration update, registration removal, read endpoint links, 1027 update endpoint links, registration request interface, removal 1028 request interface and lookup interface. However it does not assign 1029 an inteface description identifier (if=) to these interfaces. 1031 It does define a resource directory function set which specifies 1032 relevant content formats and interfaces to be used between a resource 1033 directory and endpoints. However it does not follow the format 1034 proposed by this document. 1036 A.3. Open Connectivity Foundation (OCF) 1038 The OIC Core Specification [OIC-Core] most closely aligns with the 1039 work in this specification. It makes use of interface descriptions 1040 as per [RFC6690] and has registered several interface identifiers 1041 (https://www.iana.org/assignments/core-parameters/core- 1042 parameters.xhtml#if-link-target-att-value). These interface 1043 descriptors are similar to those defined in this specification. From 1044 a high level perspective: 1046 links list: OCF (oic.if.ll) -> IETF (core.ll) 1047 Note: it's called "link list" in the IETF. 1048 linked batch: OCF (oic.if.b) -> IETF (core.lb) 1049 read-only: OCF (oic.if.r) -> IETF (core.rp) 1050 read-write: OCF (oic.if.rw) -> IETF (core.p) 1051 actuator: OCF (oic.if.a) -> IETF (core.a) 1052 sensor: OCF (oic.if.s) -> IETF (core.s) 1053 batch: No OCF equivalent -> IETF (core.b) 1055 Some of the OCF interfaces make use of collections. 1057 The OIC Core specification does not use the concept of function sets. 1058 It does however discuss the concept of profiles. The OCF defines two 1059 sets of documents. The core specification documents such as 1060 [OIC-Core] and vertical profile specification documents which provide 1061 specific information for specific applications. The OIC Smart Home 1062 Device Specification [OIC-SmartHome] is one such specification. It 1063 provides information on the resource model, discovery and data types. 1065 A.4. oneM2M 1067 OneM2M describes a technology independent functional architecture 1068 [oneM2MTS0023]. In this archictecture the reference points between 1069 functional entities are called "interfaces". This usage does not 1070 match the [RFC6690] concept of interfaces. A more direct comparison 1071 is that of 10.2/[oneM2MTS0023] that defines basic procedures and 1072 resource type-specific procedures utilising REST type create, 1073 retrieve, update, delete, notify actions. 1075 [oneM2MTS0023] does not refer to resource collections however does 1076 define "Group Management Procedures" in 10.2.7/[oneM2MTS0023]. It 1077 does allow bulk management of member resources. 1079 [oneM2MTS0023] does not use the term "function set". [oneM2MTS0008] 1080 describes the binding with the CoAP protocol. In some respects this 1081 document provides a profile of the CoAP protocol in terms of the 1082 protocol elements that need to be supported. However it does not 1083 define any interface descriptions nor collections. 1085 A.5. OMA LWM2M 1087 [OMA-TS-LWM2M] utilises the concept of interfaces. It defines the 1088 following interfaces: Bootstrap, Client Registration, Device 1089 Management and Service Enablement and Information Reporting. It 1090 defines that these have a particular direction (Uplink/Downlink) and 1091 indicates the operations that may be applied to the interface (i.e. 1092 Request Bootstrap, Write, Delete, Register, Update, De-Register, 1093 Create, Read, Write, Delete, Execute, Write Attributes, Discover, 1094 Observe, Cancel Observation, Notify). It then further defines which 1095 objects may occur over the interface. In 6/[OMA-TS-LWM2M] resource 1096 model, identifier and data formats are described. 1098 Whilst it does not formally describe the use of "collections" the use 1099 of a multiple resource TLV allows a hierarchy of resource/sub- 1100 resource. 1102 It does not identify the interfaces through an Interface Description 1103 (if=) attribute. 1105 It does not use the term function set. Informally the specification 1106 could be considered as a function set. 1108 Note: It refers to draft-ietf-core-interfaces-00. It also makes use 1109 of the binding/observation attributes from draft-ietf-dynlink-00 but 1110 does not refer to that document. 1112 Appendix B. Resource Profile example 1114 The following is a short definition of simple device resource 1115 profile. This simplistic profile is for use in the examples of this 1116 document. 1118 +--------------------+-----------+------------+---------+ 1119 | Functions | Root Path | RT | IF | 1120 +--------------------+-----------+------------+---------+ 1121 | Device Description | /d | simple.dev | core.ll | 1122 | | | | | 1123 | Sensors | /s | simple.sen | core.b | 1124 | | | | | 1125 | Actuators | /a | simple.act | core.b | 1126 +--------------------+-----------+------------+---------+ 1128 Table 3: Functional list of resources 1130 +-------+----------+----------------+---------+------------+ 1131 | Type | Path | RT | IF | Data Type | 1132 +-------+----------+----------------+---------+------------+ 1133 | Name | /d/name | simple.dev.n | core.p | xsd:string | 1134 | | | | | | 1135 | Model | /d/model | simple.dev.mdl | core.rp | xsd:string | 1136 +-------+----------+----------------+---------+------------+ 1138 Table 4: Device Description Resources 1140 +-------------+-------------+----------------+--------+-------------+ 1141 | Type | Path | RT | IF | Data Type | 1142 +-------------+-------------+----------------+--------+-------------+ 1143 | Light | /s/light | simple.sen.lt | core.s | xsd:decimal | 1144 | | | | | | 1145 | | | | | (lux) | 1146 | | | | | | 1147 | Humidity | /s/humidity | simple.sen.hum | core.s | xsd:decimal | 1148 | | | | | | 1149 | | | | | (%RH) | 1150 | | | | | | 1151 | Temperature | /s/temp | simple.sen.tmp | core.s | xsd:decimal | 1152 | | | | | | 1153 | | | | | (degC) | 1154 +-------------+-------------+----------------+--------+-------------+ 1156 Table 5: Sensor Resources 1158 +------+------------+----------------+--------+-------------+ 1159 | Type | Path | RT | IF | Data Type | 1160 +------+------------+----------------+--------+-------------+ 1161 | LED | /a/{#}/led | simple.act.led | core.a | xsd:boolean | 1162 +------+------------+----------------+--------+-------------+ 1164 Table 6: Actuator Resources 1166 Authors' Addresses 1168 Zach Shelby 1169 ARM 1170 150 Rose Orchard 1171 San Jose 95134 1172 FINLAND 1174 Phone: +1-408-203-9434 1175 Email: zach.shelby@arm.com 1177 Matthieu Vial 1178 Schneider-Electric 1179 Grenoble 1180 FRANCE 1182 Phone: +33 (0)47657 6522 1183 Email: matthieu.vial@schneider-electric.com 1184 Michael Koster 1185 SmartThings 1186 665 Clyde Avenue 1187 Mountain View 94043 1188 USA 1190 Email: michael.koster@smartthings.com 1192 Christian Groves 1193 Huawei 1194 Australia 1196 Email: cngroves.std@gmail.com