idnits 2.17.1 draft-ietf-core-interfaces-08.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 (February 24, 2017) is 2617 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-01 == Outdated reference: A later version (-28) exists of draft-ietf-core-resource-directory-09 == Outdated reference: A later version (-16) exists of draft-ietf-core-senml-04 -- 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: August 28, 2017 Schneider-Electric 6 M. Koster 7 SmartThings 8 C. Groves 9 Huawei 10 February 24, 2017 12 Reusable Interface Definitions for Constrained RESTful Environments 13 draft-ietf-core-interfaces-08 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 Status of This Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at http://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on August 28, 2017. 51 Copyright Notice 53 Copyright (c) 2017 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (http://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 Table of Contents 68 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 69 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 70 3. Collections . . . . . . . . . . . . . . . . . . . . . . . . . 5 71 3.1. Introduction to Collections . . . . . . . . . . . . . . . 5 72 3.2. Use Cases for Collections . . . . . . . . . . . . . . . . 6 73 3.3. Content-Formats for Collections . . . . . . . . . . . . . 6 74 3.4. Links and Items in Collections . . . . . . . . . . . . . 7 75 3.5. Queries on Collections . . . . . . . . . . . . . . . . . 8 76 3.6. Observing Collections . . . . . . . . . . . . . . . . . . 8 77 3.7. Collection Types . . . . . . . . . . . . . . . . . . . . 8 78 4. Interface Descriptions . . . . . . . . . . . . . . . . . . . 9 79 4.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 11 80 4.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 11 81 4.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 12 82 4.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 13 83 4.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 14 84 4.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 14 85 4.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 14 86 5. Security Considerations . . . . . . . . . . . . . . . . . . . 15 87 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 88 6.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 15 89 6.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 16 90 6.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 16 91 6.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 16 92 6.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 16 93 6.6. Read-only parameter . . . . . . . . . . . . . . . . . . . 17 94 6.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 17 95 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17 96 8. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 18 97 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 20 98 9.1. Normative References . . . . . . . . . . . . . . . . . . 20 99 9.2. Informative References . . . . . . . . . . . . . . . . . 21 100 Appendix A. Current Usage of Interfaces and Function Sets . . . 22 101 A.1. Constrained RESTful Environments (CoRE) Link Format 102 (IETF) . . . . . . . . . . . . . . . . . . . . . . . . . 22 103 A.2. CoRE Resource Directory (IETF) . . . . . . . . . . . . . 23 104 A.3. Open Connectivity Foundation (OCF) . . . . . . . . . . . 23 105 A.4. oneM2M . . . . . . . . . . . . . . . . . . . . . . . . . 24 106 A.5. OMA LWM2M . . . . . . . . . . . . . . . . . . . . . . . . 24 107 Appendix B. Resource Profile example . . . . . . . . . . . . . . 25 108 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 110 1. Introduction 112 IETF Standards for machine to machine communication in constrained 113 environments describe a REST protocol and a set of related 114 information standards that may be used to represent machine data and 115 machine metadata in REST interfaces. CoRE Link-format is a standard 116 for doing Web Linking [RFC5988] in constrained environments. SenML 117 [I-D.ietf-core-senml] is a simple data model and representation 118 format for composite and complex structured resources. CoRE Link- 119 Format and SenML can be used by CoAP [RFC7252] or HTTP servers. 121 The discovery of resources offered by a constrained server is very 122 important in machine-to-machine applications where there are no 123 humans in the loop. Machine application clients must be able to 124 adapt to different resource organizations without advance knowledge 125 of the specific data structures hosted by each connected thing. The 126 use of Web Linking for the description and discovery of resources 127 hosted by constrained web servers is specified by CoRE Link Format 128 [RFC6690]. CoRE Link Format additionally defines a link attribute 129 for interface description ("if") that can be used to describe the 130 REST interface of a resource, and may include a link to a description 131 document. 133 This document defines a set of Link Format interface descriptions for 134 some common design patterns that enable the server side composition 135 and organization, and client side discovery and consumption, of 136 machine resources using Web Linking. A client discovering the "if" 137 link attribute will be able to consume resources based on its 138 knowledge of the expected interface types. In this sense the 139 Interface Type acts in a similar way as a Content-Format, but as a 140 selector for a high level functional abstraction. 142 An interface description describes a resource in terms of it's 143 associated content formats, data types, URI templates, REST methods, 144 parameters, and responses. Basic interface descriptions are defined 145 for sensors, actuators, and properties. 147 A set of collection types is defined for organizing resources for 148 discovery, and for various forms of bulk interaction with resource 149 sets using typed embedding links. 151 This document first defines the concept of collection interface 152 descriptions. It then defines a number of generic interface 153 descriptions that may be used in contrained environments. Several of 154 these interface descriptions utilise collections. 156 Whilst this document assumes the use of CoAP [RFC7252], the REST 157 interfaces described can also be realized using HTTP [RFC7230]. 159 2. Terminology 161 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 162 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 163 "OPTIONAL" in this document are to be interpreted as described in 164 [RFC2119]. 166 This document requires readers to be familiar with all the terms and 167 concepts that are discussed in [RFC5988] and [RFC6690]. This 168 document makes use of the following additional terminology: 170 Gradual Reveal: A REST design where resources are discovered 171 progressively using Web Linking. 173 Interface Description: The Interface Description describes the 174 generic REST interface to interact with a resource or a set of 175 resources. Its use is described via the Interface Description 176 'if' attribute which is an opaque string used to provide a name or 177 URI indicating a specific interface definition used to interact 178 with the target resource. One can think of this as describing 179 verbs usable on a resource. 181 Resource Discovery: The process allowing a web client to identify 182 resources being hosted on a web server. 184 Service Discovery: The process making it possible for a web client 185 to automatically detect devices and Function Sets offered by these 186 devices on a CoRE network. 188 3. Collections 190 3.1. Introduction to Collections 192 A Collection is a resource which represents one or more related 193 resources. [RFC6573] describes the "item" and "collection" Link 194 Relation. "item" link relation identifies a member of collection. 195 "collection" indicates the collection that an item is a member of. 196 For example: A collection might be a resource representing catalog of 197 products, an item is a resource related to an individual product. 199 Section 1.2.2/[RFC6690] also describes resource collections. 201 This document uses the concept of "collection" and applies it to 202 interface descriptions. A collection interface description consists 203 of a set of links and a set of items pointed to by the links which 204 may be sub-resources of the collection resource. The collection 205 interface descriptions described in this document are Link List, 206 Batch and Linked Batch. 208 The links in a collection are represented in CoRE Link-Format 209 Content-Formats including JSON and CBOR variants, and the items in 210 the collection may be represented by senml, including JSON and CBOR 211 variants. In general, a collection may support items of any 212 available Content-Format. 214 A particular resource item may be a member of more than one 215 collection at a time by being linked to, but may only be a 216 subresource of one collection. 218 Some collections may have pre-configured items and links, and some 219 collections may support dynamic creation and removal of items and 220 links. Likewise, modification of items in some collections may be 221 permitted, and not in others. 223 Collections may support link embedding, which is analogous to an 224 image tag (link) causing the image to display inline in a browser 225 window. Resources pointed to by embedded links in collections may be 226 interacted with using bulk operations on the collection resource. 227 For example, performing a GET on a collection resource may return a 228 single representation containing all of the linked resources. 230 Links in collections may be selected for processing by a particular 231 request by using Query Filtering as described in CoRE Link-Format 232 [RFC6690]. 234 3.2. Use Cases for Collections 236 Collections may be used to provide gradual reveal of resources on an 237 endpoint. There may be a small set of links at the .well-known/core 238 location, which may in turn point to other collections of resources 239 that represent device information, device configuration, device 240 management, and various functional clusters of resources on the 241 device. 243 A collection may provide resource encapsulation, where link embedding 244 may be used to provide a single resource with which a client may 245 interact to obtain a set of related resource values. For example, a 246 collection for manufacturer parameters may consist of manufacturer 247 name, date of manufacture, location of manufacture, and serial number 248 resources which can be read as a single senml data object. 250 A collection may be used to group a set of like resources for bulk 251 state update or actuation. For example, the brightness control 252 resources of a number of luminaries may be grouped by linking to them 253 in a collection. The collection type may support receiving a single 254 update form a client and sending that update to each resource item in 255 the collection. 257 Items may be sub-resources of the collection resource. This enables 258 updates to multiple items in the collection to be processed together 259 within the context of the collection resource. 261 3.3. Content-Formats for Collections 263 The collection interfaces by default use CoRE Link-Format for the 264 link representations and SenML or text/plain for representations of 265 items. The examples given are for collections that expose resources 266 and links in these formats. In addition, a new "collection" Content- 267 Format is defined based on the SenML framework which represents both 268 links and items in the collection. 270 The choice of whether to return a representation of the links or of 271 the items or of the collection format is determined by the Accept 272 header option in the request. Likewise, the choice of updating link 273 metadata or item data or the collection resource itself is determined 274 by the Content-Format option in the header of the update request 275 operation. 277 The default Content-Formats for collection types described in this 278 document are: 280 Links: application/link-format, application/link-format+json 281 Items: application/senml+json, text/plain 283 3.4. Links and Items in Collections 285 Links use CoRE Link-Format representation by default and may point to 286 any resource reachable from the context of the collection. This 287 includes absolute links and links that point to other network 288 locations if the context of the collection allows. Links to sub- 289 resources in the collection MUST have a path-element starting with 290 the resource name, as per [RFC3986]. Links to resources in the 291 global context MUST start with a root path identifier [RFC5988]. 292 Links to other collections are formed per [RFC3986]. 294 Examples of links: 296 ;if="core.lb"': Link to the /sen/ collection describing it as 297 a core.lb type collection (Linked Batch) 299 ;rel="grp"': Link to the /sen/ collection indicating that 300 /sen/ is a member of a group in the collection in which the link 301 appears. 303 <"/sen/temp">;rt="temperature"': An absolute link to the resource at 304 the path /sen/temp 306 ;rt="temperature": Link to the temp subresource of the 307 collection in which this link appears." 309 ;anchor="/sen/": A link to the temp subresource of the 310 collection /sen/ which is assumed not to be a subresource of the 311 collection in which the link appears ,but is expected to be 312 identified in the collection by resource name. 314 Links in the collection MAY be Read, Updated, Added, or Removed using 315 the CoRE Link-Format or JSON Merge-Patch Content-Formats on the 316 collection resource. Reading links uses the GET method and returns 317 an array or list containing the link-values of all selected links. 318 Links may be added to the collection using POST or PATCH methods. 319 Updates to links MUST use the PATCH method and MAY use query 320 filtering to select links for updating. The PATCH method on links 321 MUST use the JSON Merge-Patch Content-Format (application/merge- 322 patch+json) specified in [RFC7396]. 324 Items in the collection SHOULD be represented using the SenML 325 (application/senml+json) or plain text (text/plain) Content-Formats, 326 depending on whether the representation is of a single data point or 327 multiple data points. Items MAY be represented using any supported 328 Content-Format. 330 Link Embedding enables the bulk processing of items in the collection 331 using a single operation targeting the collection resource. A subset 332 of resources in the collection may be selected for operation using 333 Query Filtering. Bulk Read operations using GET return a SenML 334 representation of all selected resources. Bulk item Update 335 operations using PUT or POST apply the payload document to all 336 selected resource items in the collection, using either a Batch or 337 Group update policy. A Batch update is performed by applying the 338 resource values in the payload document to all resources in the 339 collection that match any resource name in the payload document. 340 Group updates are performed by applying the payload document to each 341 item in the collection. Group updates are indicated by the link 342 relation type rel="grp" in the link. 344 3.5. Queries on Collections 346 Collections MAY support query filtering as defined in CoRE Link- 347 Format [RFC6690]. Operations targeting either the links or the items 348 MAY select a subset of links and items in the collection by using 349 query filtering. The Content-Format specified in the request header 350 selects whether links or items are targeted by the operation. 352 3.6. Observing Collections 354 Resource Observation via [I-D.ietf-core-dynlink] using CoAP [RFC7252] 355 MAY be supported on items in a collection. A subset of the 356 conditional observe parameters MAY be specified to apply. In most 357 cases pmin and pmax are useful. Resource observation on a 358 collection's items resource MAY report any changes of resource state 359 in any item in the collection. Observation Responses, or 360 notifications, SHOULD provide representations of the resources that 361 have changed in SenML Content-Format. Notifications MAY include 362 multiple observations of a particular resource, with SenML time 363 stamps indicating the observation times. 365 3.7. Collection Types 367 There are three collection types defined in this document: 369 +-----------------+---------+--------------------+ 370 | Collection Type | if= | Content-Format | 371 +-----------------+---------+--------------------+ 372 | Link List | core.ll | link-format | 373 | | | | 374 | Batch | core.b | link-format, senml | 375 | | | | 376 | Linked Batch | core.lb | link-format, senml | 377 +-----------------+---------+--------------------+ 379 Table 1: Collection Type Summary 381 The interface description defined in this document describes the 382 methods and functions that may be applied to the collections. 384 4. Interface Descriptions 386 This section defines REST interfaces for Link List, Batch, Sensor, 387 Parameter and Actuator resources. Variants such as Linked Batch or 388 Read-Only Parameter are also presented. Each type is described along 389 with its Interface Description attribute value and valid methods. 390 These are defined for each interface in the table below. These 391 interfaces can support plain text and/or SenML Media types. 393 The if= column defines the Interface Description (if=) attribute 394 value to be used in the CoRE Link Format for a resource conforming to 395 that interface. When this value appears in the if= attribute of a 396 link, the resource MUST support the corresponding REST interface 397 described in this section. The resource MAY support additional 398 functionality, which is out of scope for this document. Although 399 these interface descriptions are intended to be used with the CoRE 400 Link Format, they are applicable for use in any REST interface 401 definition. 403 The Methods column defines the methods supported by that interface, 404 which are described in more detail below. 406 +--------------+---------+-----------------+--------------------+ 407 | Interface | if= | Methods | Content-Formats | 408 +--------------+---------+-----------------+--------------------+ 409 | Link List | core.ll | GET | link-format | 410 | | | | | 411 | Batch | core.b | GET, PUT, POST | link-format, senml | 412 | | | | | 413 | Linked Batch | core.lb | GET, PUT, POST, | link-format, senml | 414 | | | | | 415 | | | DELETE | | 416 | | | | | 417 | Sensor | core.s | GET | link-format, | 418 | | | | | 419 | | | | text/plain | 420 | | | | | 421 | Parameter | core.p | GET, PUT | link-format, | 422 | | | | | 423 | | | | text/plain | 424 | | | | | 425 | Read-only | core.rp | GET | link-format, | 426 | | | | | 427 | Parameter | | | text/plain | 428 | | | | | 429 | Actuator | core.a | GET, PUT, POST | link-format, | 430 | | | | | 431 | | | | text/plain | 432 +--------------+---------+-----------------+--------------------+ 434 Table 2: Interface Description Summary 436 The following is an example of links in the CoRE Link Format using 437 these interface descriptions. The resource hierarchy is based on a 438 simple resource profile defined in Appendix B. These links are used 439 in the subsequent examples below. 441 Req: GET /.well-known/core 442 Res: 2.05 Content (application/link-format) 443 ;rt="simple.sen";if="core.b", 444 ;rt="simple.sen.lt";if="core.s", 445 ;rt="simple.sen.tmp";if="core.s";obs, 446 ;rt="simple.sen.hum";if="core.s", 447 ;rt="simple.act";if="core.b", 448 ;rt="simple.act.led";if="core.a", 449 ;rt="simple.act.led";if="core.a", 450 ;rt="simple.dev";if="core.ll", 451 ;if="core.lb", 453 Figure 1: Binding Interface Example 455 4.1. Link List 457 The Link List interface is used to retrieve (GET) a list of resources 458 on a web server. The GET request SHOULD contain an Accept option 459 with the application/link-format content format. However if the 460 resource does not support any other form of content-format the Accept 461 option MAY be elided. 463 Note: The use of an Accept option with application/link-format is 464 recommended even though it is not strictly needed for the link list 465 interface because this interface is extended by the batch and linked 466 batch interfaces where different content-formats are possible. 468 The request returns a list of URI references with absolute paths to 469 the resources as defined in CoRE Link Format. This interface is 470 typically used with a parent resource to enumerate sub-resources but 471 may be used to reference any resource on a web server. 473 Link List is the base interface to provide gradual reveal of 474 resources on a CoRE web server, hence the root resource of a Function 475 Set SHOULD implement this interface or an extension of this 476 interface. 478 The following example interacts with a Link List /d containing 479 Parameter sub-resources /d/name, /d/model. 481 Req: GET /d/ (Accept:application/link-format) 482 Res: 2.05 Content (application/link-format) 483 ;rt="simple.dev.n";if="core.p", 484 ;rt="simple.dev.mdl";if="core.rp" 486 4.2. Batch 488 The Batch interface is used to manipulate a collection of sub- 489 resources at the same time. The Batch interface description supports 490 the same methods as its sub-resources, and can be used to read (GET), 491 update (PUT) or apply (POST) the values of those sub-resource with a 492 single resource representation. The sub-resources of a Batch MAY be 493 heterogeneous, a method used on the Batch only applies to sub- 494 resources that support it. For example Sensor interfaces do not 495 support PUT, and thus a PUT request to a Sensor member of that Batch 496 would be ignored. A batch requires the use of SenML Media types in 497 order to support multiple sub-resources. 499 In addition, the Batch interface is an extension of the Link List 500 interface and in consequence MUST support the same methods. For 501 example: a GET with an Accept:application/link-format on a resource 502 utilizing the batch interface will return the sub-resource links. 504 The following example interacts with a Batch /s/ with Sensor sub- 505 resources /s/light, /s/temp and /s/humidity. 507 Req: GET /s/ 508 Res: 2.05 Content (application/senml+json) 509 {"e":[ 510 { "n": "light", "v": 123, "u": "lx" }, 511 { "n": "temp", "v": 27.2, "u": "degC" }, 512 { "n": "humidity", "v": 80, "u": "%RH" }], 513 } 515 4.3. Linked Batch 517 The Linked Batch interface is an extension of the Batch interface. 518 Contrary to the basic Batch which is a collection statically defined 519 by the web server, a Linked Batch is dynamically controlled by a web 520 client. A Linked Batch resource has no sub-resources. Instead the 521 resources forming the batch are referenced using Web Linking 522 [RFC5988] and the CoRE Link Format [RFC6690]. A request with a POST 523 method and a content format of application/link-format simply appends 524 new resource links to the collection. The links in the payload MUST 525 reference a resource on the web server with an absolute path. A 526 DELETE request removes the entire collection. All other requests 527 available for a basic Batch are still valid for a Linked Batch. 529 The following example interacts with a Linked Batch /l/ and creates a 530 collection containing /s/light, /s/temp and /s/humidity in 2 steps. 532 Req: POST /l/ (Content-Format: application/link-format) 533 , 534 Res: 2.04 Changed 536 Req: GET /l/ 537 Res: 2.05 Content (application/senml+json) 538 {"e":[ 539 { "n": "/s/light", "v": 123, "u": "lx" }, 540 { "n": "/s/temp", "v": 27.2, "u": "degC" }, 541 } 543 Req: POST /l/ (Content-Format: application/link-format) 544 545 Res: 2.04 Changed 547 Req: GET /l/ (Accept: application/link-format) 548 Res: 2.05 Content (application/link-format) 549 ,, 551 Req: GET /l/ 552 Res: 2.05 Content (application/senml+json) 553 {"e":[ 554 { "n": "/s/light", "v": 123, "u": "lx" }, 555 { "n": "/s/temp", "v": 27.2, "u": "degC" }, 556 { "n": "/s/humidity", "v": 80, "u": "%RH" }], 557 } 559 Req: DELETE /l/ 560 Res: 2.02 Deleted 562 4.4. Sensor 564 The Sensor interface allows the value of a sensor resource to be read 565 (GET). The Media type of the resource can be either plain text or 566 SenML. Plain text MAY be used for a single measurement that does not 567 require meta-data. For a measurement with meta-data such as a unit 568 or time stamp, SenML SHOULD be used. A resource with this interface 569 MAY use SenML to return multiple measurements in the same 570 representation, for example a list of recent measurements. 572 The following are examples of Sensor interface requests in both text/ 573 plain and application/senml+json. 575 Req: GET /s/humidity (Accept: text/plain) 576 Res: 2.05 Content (text/plain) 577 80 579 Req: GET /s/humidity (Accept: application/senml+json) 580 Res: 2.05 Content (application/senml+json) 581 {"e":[ 582 { "n": "humidity", "v": 80, "u": "%RH" }], 583 } 585 4.5. Parameter 587 The Parameter interface allows configurable parameters and other 588 information to be modeled as a resource. The value of the parameter 589 can be read (GET) or update (PUT). Plain text or SenML Media types 590 MAY be returned from this type of interface. 592 The following example shows request for reading and updating a 593 parameter. 595 Req: GET /d/name 596 Res: 2.05 Content (text/plain) 597 node5 599 Req: PUT /d/name (text/plain) 600 outdoor 601 Res: 2.04 Changed 603 4.6. Read-only Parameter 605 The Read-only Parameter interface allows configuration parameters to 606 be read (GET) but not updated. Plain text or SenML Media types MAY 607 be returned from this type of interface. 609 The following example shows request for reading such a parameter. 611 Req: GET /d/model 612 Res: 2.05 Content (text/plain) 613 SuperNode200 615 4.7. Actuator 617 The Actuator interface is used by resources that model different 618 kinds of actuators (changing its value has an effect on its 619 environment). Examples of actuators include for example LEDs, 620 relays, motor controllers and light dimmers. The current value of 621 the actuator can be read (GET) or the actuator value can be updated 622 (PUT). In addition, this interface allows the use of POST to change 623 the state of an actuator, for example to toggle between its possible 624 values. Plain text or SenML Media types MAY be returned from this 625 type of interface. A resource with this interface MAY use SenML to 626 include multiple measurements in the same representation, for example 627 a list of recent actuator values or a list of values to updated. 629 The following example shows requests for reading, setting and 630 toggling an actuator (turning on a LED). 632 Req: GET /a/1/led 633 Res: 2.05 Content (text/plain) 634 0 636 Req: PUT /a/1/led (text/plain) 637 1 638 Res: 2.04 Changed 640 Req: POST /a/1/led (text/plain) 641 Res: 2.04 Changed 643 Req: GET /a/1/led 644 Res: 2.05 Content (text/plain) 645 0 647 5. Security Considerations 649 An implementation of a client needs to be prepared to deal with 650 responses to a request that differ from what is specified in this 651 document. A server implementing what the client thinks is a resource 652 with one of these interface descriptions could return malformed 653 representations and response codes either by accident or maliciously. 654 A server sending maliciously malformed responses could attempt to 655 take advantage of a poorly implemented client for example to crash 656 the node or perform denial of service. 658 6. IANA Considerations 660 This document registers the following CoRE Interface Description 661 (if=) Link Target Attribute Values. 663 6.1. Link List 665 Attribute Value: core.ll 667 Description: The Link List interface is used to retrieve a list of 668 resources on a web server. 670 Reference: This document. Note to RFC Editor - please insert the 671 appropriate RFC reference. 673 Notes: None 675 6.2. Batch 677 Attribute Value: core.b 679 Description: The Batch interface is used to manipulate a collection 680 of sub-resources at the same time. 682 Reference: This document. Note to RFC Editor - please insert the 683 appropriate RFC reference. 685 Notes: None 687 6.3. Linked Batch 689 Attribute Value: core.lb 691 Description: The Linked Batch interface is an extension of the Batch 692 interface. Contrary to the basic Batch which is a collection 693 statically defined by the web server, a Linked Batch is 694 dynamically controlled by a web client. 696 Reference: This document. Note to RFC Editor - please insert the 697 appropriate RFC reference. 699 Notes: None 701 6.4. Sensor 703 Attribute Value: core.s 705 Description: The Sensor interface allows the value of a sensor 706 resource to be read. 708 Reference: This document. Note to RFC Editor - please insert the 709 appropriate RFC reference. 711 Notes: None 713 6.5. Parameter 715 Attribute Value: core.p 716 Description: The Parameter interface allows configurable parameters 717 and other information to be modeled as a resource. The value of 718 the parameter can be read or update. 720 Reference: This document. Note to RFC Editor - please insert the 721 appropriate RFC reference. 723 Notes: None 725 6.6. Read-only parameter 727 Attribute Value: core.rp 729 Description: The Read-only Parameter interface allows configuration 730 parameters to be read but not updated. 732 Reference: This document. Note to RFC Editor - please insert the 733 appropriate RFC reference. 735 Notes: None 737 6.7. Actuator 739 Attribute Value: core.a 741 Description: The Actuator interface is used by resources that model 742 different kinds of actuators (changing its value has an effect on 743 its environment). Examples of actuators include for example LEDs, 744 relays, motor controllers and light dimmers. The current value of 745 the actuator can be read or the actuator value can be updated. In 746 addition, this interface allows the use of POST to change the 747 state of an actuator, for example to toggle between its possible 748 values. 750 Reference: This document. Note to RFC Editor - please insert the 751 appropriate RFC reference. 753 Notes: None 755 7. Acknowledgements 757 Acknowledgement is given to colleagues from the SENSEI project who 758 were critical in the initial development of the well-known REST 759 interface concept, to members of the IPSO Alliance where further 760 requirements for interface descriptions have been discussed, and to 761 Szymon Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann 762 who have provided useful discussion and input to the concepts in this 763 document. 765 8. Changelog 767 Changes from -07 to 08: 769 o Section 3.3: Modified Accepts to Accept header option. 771 o Addressed the editor's note in Section 4.1 to clarify the use of 772 the Accept option. 774 Changes from -06 to 07: 776 o Corrected Figure 1 sub-resource names e.g. tmp to temp and hum to 777 humidity. 779 o Addressed the editor's note in Section 4.2. 781 o Removed section on function sets and profiles as agreed to at the 782 IETF#97. 784 Changes from -05 to -06: 786 o Updated the abstract. 788 o Section 1: Updated introduction. 790 o Section 2: Alphabetised the order 792 o Section 2: Removed the collections definition in favour of the 793 complete definition in the collections section. 795 o Removed section 3 on interfaces in favour of an updated definition 796 in section 1.3. 798 o General: Changed interface type to interface description as that 799 is the term defined in RFC6690. 801 o Removed section on future interfaces. 803 o Section 8: Updated IANA considerations. 805 o Added Appendix A to discuss current state of the art wrt to 806 collections, function sets etc. 808 Changes from -04 to -05: 810 o Removed Link Bindings and Observe attributes. This functionality 811 is now contained in I-D.ietf-core-dynlink. 813 o Hypermedia collections have been removed. This is covered in a 814 new T2TRG draft. 816 o The WADL description has been removed. 818 o Fixed minor typos. 820 o Updated references. 822 Changes from -03 to -04: 824 o Fixed tickets #385 and #386. 826 o Changed abstract and into to better describe content. 828 o Focus on Interface and not function set/profiles in intro. 830 o Changed references from draft-core-observe to RFC7641. 832 o Moved Function sets and Profiles to section after Interfaces. 834 o Moved Observe Attributes to the Link Binding section. 836 o Add a Collection section to describe the collection types. 838 o Add the Hypermedia Collection Interface Description. 840 Changes from -02 to -03: 842 o Added lt and gt to binding format section. 844 o Added pmin and pmax observe parameters to Observation Attributes. 846 o Changed the definition of lt and gt to limit crossing. 848 o Added definitions for getattr and setattr to WADL. 850 o Added getattr and setattr to observable interfaces. 852 o Removed query parameters from Observe definition. 854 o Added observe-cancel definition to WADL and to observable 855 interfaces. 857 Changes from -01 to -02: 859 o Updated the date and version, fixed references. 861 o "Removed pmin and pmax observe parameters "[Ticket #336]"." 863 Changes from -00 to WG Document -01 865 o Improvements to the Function Set section. 867 Changes from -05 to WG Document -00 869 o Updated the date and version. 871 Changes from -04 to -05 873 o Made the Observation control parameters to be treated as resources 874 rather than Observe query parameters. Added Less Than and Greater 875 Than parameters. 877 Changes from -03 to -04 879 o Draft refresh 881 Changes from -02 to -03 883 o Added Bindings 885 o Updated all rt= and if= for the new Link Format IANA rules 887 Changes from -01 to -02 889 o Defined a Function Set and its guidelines. 891 o Added the Link List interface. 893 o Added the Linked Batch interface. 895 o Improved the WADL interface definition. 897 o Added a simple profile example. 899 9. References 901 9.1. Normative References 903 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 904 Requirement Levels", BCP 14, RFC 2119, 905 DOI 10.17487/RFC2119, March 1997, 906 . 908 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 909 DOI 10.17487/RFC5988, October 2010, 910 . 912 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 913 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 914 . 916 9.2. Informative References 918 [I-D.ietf-core-dynlink] 919 Shelby, Z., Vial, M., Koster, M., and C. Groves, "Dynamic 920 Resource Linking for Constrained RESTful Environments", 921 draft-ietf-core-dynlink-01 (work in progress), October 922 2016. 924 [I-D.ietf-core-resource-directory] 925 Shelby, Z., Koster, M., Bormann, C., and P. Stok, "CoRE 926 Resource Directory", draft-ietf-core-resource-directory-09 927 (work in progress), October 2016. 929 [I-D.ietf-core-senml] 930 Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C. 931 Bormann, "Media Types for Sensor Measurement Lists 932 (SenML)", draft-ietf-core-senml-04 (work in progress), 933 October 2016. 935 [OIC-Core] 936 "OIC Resource Type Specification v1.1.0", 2016, 937 . 939 [OIC-SmartHome] 940 "OIC Smart Home Device Specification v1.1.0", 2016, 941 . 943 [OMA-TS-LWM2M] 944 "Lightweight Machine to Machine Technical Specification", 945 2016, . 949 [oneM2MTS0008] 950 "TS 0008 v1.3.2 CoAP Protocol Binding", 2016, 951 . 953 [oneM2MTS0023] 954 "TS 0023 v2.0.0 Home Appliances Information Model and 955 Mapping", 2016, 956 . 958 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 959 Resource Identifier (URI): Generic Syntax", STD 66, 960 RFC 3986, DOI 10.17487/RFC3986, January 2005, 961 . 963 [RFC6573] Amundsen, M., "The Item and Collection Link Relations", 964 RFC 6573, DOI 10.17487/RFC6573, April 2012, 965 . 967 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 968 Protocol (HTTP/1.1): Message Syntax and Routing", 969 RFC 7230, DOI 10.17487/RFC7230, June 2014, 970 . 972 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 973 Application Protocol (CoAP)", RFC 7252, 974 DOI 10.17487/RFC7252, June 2014, 975 . 977 [RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396, 978 DOI 10.17487/RFC7396, October 2014, 979 . 981 Appendix A. Current Usage of Interfaces and Function Sets 983 Editor's note: This appendix will be removed. It is only included 984 for information. 986 This appendix analyses the current landscape with regards the 987 definition and use of collections, interfaces and function sets/ 988 profiles. This should be considered when considering the scope of 989 this document. 991 In summary it can be seen that there is a lack of consistancy of the 992 definition and usage of interface description and function sets. 994 A.1. Constrained RESTful Environments (CoRE) Link Format (IETF) 996 [RFC6690] assumes that different deployments or application domains 997 will define the appropriate REST Interface Descriptions along with 998 Resource Types to make discovery meaningful. It highlights that 999 collections are often used for these interfaces. 1001 Whilst 3.2/[RFC6690] defines a new Interface Description 'if' 1002 attribute the procedures around it are about the naming of the 1003 interface not what information should be included in the 1004 documentation about the interface. 1006 Function sets are not discussed. 1008 A.2. CoRE Resource Directory (IETF) 1010 [I-D.ietf-core-resource-directory] uses the concepts of collections, 1011 interfaces and function sets. 1013 If defines a number of interfaces: discovery, registration, 1014 registration update, registration removal, read endpoint links, 1015 update endpoint links, registration request interface, removal 1016 request interface and lookup interface. However it does not assign 1017 an inteface description identifier (if=) to these interfaces. 1019 It does define a resource directory function set which specifies 1020 relevant content formats and interfaces to be used between a resource 1021 directory and endpoints. However it does not follow the format 1022 proposed by this document. 1024 A.3. Open Connectivity Foundation (OCF) 1026 The OIC Core Specification [OIC-Core] most closely aligns with the 1027 work in this specification. It makes use of interface descriptions 1028 as per [RFC6690] and has registered several interface identifiers 1029 (https://www.iana.org/assignments/core-parameters/core- 1030 parameters.xhtml#if-link-target-att-value). These interface 1031 descriptors are similar to those defined in this specification. From 1032 a high level perspective: 1034 links list: OCF (oic.if.ll) -> IETF (core.ll) 1035 Note: it's called "link list" in the IETF. 1036 linked batch: OCF (oic.if.b) -> IETF (core.lb) 1037 read-only: OCF (oic.if.r) -> IETF (core.rp) 1038 read-write: OCF (oic.if.rw) -> IETF (core.p) 1039 actuator: OCF (oic.if.a) -> IETF (core.a) 1040 sensor: OCF (oic.if.s) -> IETF (core.s) 1041 batch: No OCF equivalent -> IETF (core.b) 1043 Some of the OCF interfaces make use of collections. 1045 The OIC Core specification does not use the concept of function sets. 1046 It does however discuss the concept of profiles. The OCF defines two 1047 sets of documents. The core specification documents such as 1048 [OIC-Core] and vertical profile specification documents which provide 1049 specific information for specific applications. The OIC Smart Home 1050 Device Specification [OIC-SmartHome] is one such specification. It 1051 provides information on the resource model, discovery and data types. 1053 A.4. oneM2M 1055 OneM2M describes a technology independent functional architecture 1056 [oneM2MTS0023]. In this archictecture the reference points between 1057 functional entities are called "interfaces". This usage does not 1058 match the [RFC6690] concept of interfaces. A more direct comparison 1059 is that of 10.2/[oneM2MTS0023] that defines basic procedures and 1060 resource type-specific procedures utilising REST type create, 1061 retrieve, update, delete, notify actions. 1063 [oneM2MTS0023] does not refer to resource collections however does 1064 define "Group Management Procedures" in 10.2.7/[oneM2MTS0023]. It 1065 does allow bulk management of member resources. 1067 [oneM2MTS0023] does not use the term "function set". [oneM2MTS0008] 1068 describes the binding with the CoAP protocol. In some respects this 1069 document provides a profile of the CoAP protocol in terms of the 1070 protocol elements that need to be supported. However it does not 1071 define any interface descriptions nor collections. 1073 A.5. OMA LWM2M 1075 [OMA-TS-LWM2M] utilises the concept of interfaces. It defines the 1076 following interfaces: Bootstrap, Client Registration, Device 1077 Management and Service Enablement and Information Reporting. It 1078 defines that these have a particular direction (Uplink/Downlink) and 1079 indicates the operations that may be applied to the interface (i.e. 1080 Request Bootstrap, Write, Delete, Register, Update, De-Register, 1081 Create, Read, Write, Delete, Execute, Write Attributes, Discover, 1082 Observe, Cancel Observation, Notify). It then further defines which 1083 objects may occur over the interface. In 6/[OMA-TS-LWM2M] resource 1084 model, identifier and data formats are described. 1086 Whilst it does not formally describe the use of "collections" the use 1087 of a multiple resource TLV allows a hierarchy of resource/sub- 1088 resource. 1090 It does not identify the interfaces through an Interface Description 1091 (if=) attribute. 1093 It does not use the term function set. Informally the specification 1094 could be considered as a function set. 1096 Note: It refers to draft-ietf-core-interfaces-00. It also makes use 1097 of the binding/observation attributes from draft-ietf-dynlink-00 but 1098 does not refer to that document. 1100 Appendix B. Resource Profile example 1102 The following is a short definition of simple device resource 1103 profile. This simplistic profile is for use in the examples of this 1104 document. 1106 +--------------------+-----------+------------+---------+ 1107 | Functions | Root Path | RT | IF | 1108 +--------------------+-----------+------------+---------+ 1109 | Device Description | /d | simple.dev | core.ll | 1110 | | | | | 1111 | Sensors | /s | simple.sen | core.b | 1112 | | | | | 1113 | Actuators | /a | simple.act | core.b | 1114 +--------------------+-----------+------------+---------+ 1116 Table 3: Functional list of resources 1118 +-------+----------+----------------+---------+------------+ 1119 | Type | Path | RT | IF | Data Type | 1120 +-------+----------+----------------+---------+------------+ 1121 | Name | /d/name | simple.dev.n | core.p | xsd:string | 1122 | | | | | | 1123 | Model | /d/model | simple.dev.mdl | core.rp | xsd:string | 1124 +-------+----------+----------------+---------+------------+ 1126 Table 4: Device Description Resources 1128 +-------------+-------------+----------------+--------+-------------+ 1129 | Type | Path | RT | IF | Data Type | 1130 +-------------+-------------+----------------+--------+-------------+ 1131 | Light | /s/light | simple.sen.lt | core.s | xsd:decimal | 1132 | | | | | | 1133 | | | | | (lux) | 1134 | | | | | | 1135 | Humidity | /s/humidity | simple.sen.hum | core.s | xsd:decimal | 1136 | | | | | | 1137 | | | | | (%RH) | 1138 | | | | | | 1139 | Temperature | /s/temp | simple.sen.tmp | core.s | xsd:decimal | 1140 | | | | | | 1141 | | | | | (degC) | 1142 +-------------+-------------+----------------+--------+-------------+ 1144 Table 5: Sensor Resources 1146 +------+------------+----------------+--------+-------------+ 1147 | Type | Path | RT | IF | Data Type | 1148 +------+------------+----------------+--------+-------------+ 1149 | LED | /a/{#}/led | simple.act.led | core.a | xsd:boolean | 1150 +------+------------+----------------+--------+-------------+ 1152 Table 6: Actuator Resources 1154 Authors' Addresses 1156 Zach Shelby 1157 ARM 1158 150 Rose Orchard 1159 San Jose 95134 1160 FINLAND 1162 Phone: +1-408-203-9434 1163 Email: zach.shelby@arm.com 1165 Matthieu Vial 1166 Schneider-Electric 1167 Grenoble 1168 FRANCE 1170 Phone: +33 (0)47657 6522 1171 Email: matthieu.vial@schneider-electric.com 1172 Michael Koster 1173 SmartThings 1174 665 Clyde Avenue 1175 Mountain View 94043 1176 USA 1178 Email: michael.koster@smartthings.com 1180 Christian Groves 1181 Huawei 1182 Australia 1184 Email: cngroves.std@gmail.com