idnits 2.17.1 draft-ietf-core-interfaces-10.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 (September 14, 2017) is 2415 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-03 == Outdated reference: A later version (-28) exists of draft-ietf-core-resource-directory-11 == Outdated reference: A later version (-16) exists of draft-ietf-core-senml-10 -- 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 M. Vial 5 Expires: March 18, 2018 Schneider-Electric 6 M. Koster 7 SmartThings 8 C. Groves 10 J. Zhu 11 Huawei 12 B. Silverajan, Ed. 13 Tampere University of Technology 14 September 14, 2017 16 Reusable Interface Definitions for Constrained RESTful Environments 17 draft-ietf-core-interfaces-10 19 Abstract 21 This document defines a set of Constrained RESTful Environments 22 (CoRE) Link Format Interface Descriptions [RFC6690] applicable for 23 use in constrained environments. These include the: Actuator, 24 Parameter, Read-only parameter, Sensor, Batch, Linked Batch and Link 25 List interfaces. 27 The Batch, Linked Batch and Link List interfaces make use of resource 28 collections. This document further describes how collections relate 29 to interfaces. 31 Many applications require a set of interface descriptions in order 32 provide the required functionality. This document defines the 33 concept of function sets to specify this set of interfaces and 34 resources. 36 Editor's notes: 38 o The git repository for the draft is found at https://github.com/ 39 core-wg/interfaces 41 Status of This Memo 43 This Internet-Draft is submitted in full conformance with the 44 provisions of BCP 78 and BCP 79. 46 Internet-Drafts are working documents of the Internet Engineering 47 Task Force (IETF). Note that other groups may also distribute 48 working documents as Internet-Drafts. The list of current Internet- 49 Drafts is at http://datatracker.ietf.org/drafts/current/. 51 Internet-Drafts are draft documents valid for a maximum of six months 52 and may be updated, replaced, or obsoleted by other documents at any 53 time. It is inappropriate to use Internet-Drafts as reference 54 material or to cite them other than as "work in progress." 56 This Internet-Draft will expire on March 18, 2018. 58 Copyright Notice 60 Copyright (c) 2017 IETF Trust and the persons identified as the 61 document authors. All rights reserved. 63 This document is subject to BCP 78 and the IETF Trust's Legal 64 Provisions Relating to IETF Documents 65 (http://trustee.ietf.org/license-info) in effect on the date of 66 publication of this document. Please review these documents 67 carefully, as they describe your rights and restrictions with respect 68 to this document. Code Components extracted from this document must 69 include Simplified BSD License text as described in Section 4.e of 70 the Trust Legal Provisions and are provided without warranty as 71 described in the Simplified BSD License. 73 Table of Contents 75 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 76 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 77 3. Collections . . . . . . . . . . . . . . . . . . . . . . . . . 5 78 3.1. Introduction to Collections . . . . . . . . . . . . . . . 5 79 3.2. Use Cases for Collections . . . . . . . . . . . . . . . . 6 80 3.3. Content-Formats for Collections . . . . . . . . . . . . . 6 81 3.4. Links and Items in Collections . . . . . . . . . . . . . 7 82 3.5. Queries on Collections . . . . . . . . . . . . . . . . . 8 83 3.6. Observing Collections . . . . . . . . . . . . . . . . . . 8 84 3.7. Collection Types . . . . . . . . . . . . . . . . . . . . 8 85 4. Interface Descriptions . . . . . . . . . . . . . . . . . . . 9 86 4.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 11 87 4.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 11 88 4.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 12 89 4.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 13 90 4.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 14 91 4.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 14 92 4.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 14 93 5. Security Considerations . . . . . . . . . . . . . . . . . . . 15 94 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 95 6.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 15 96 6.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 16 97 6.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 16 98 6.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 16 99 6.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 16 100 6.6. Read-only parameter . . . . . . . . . . . . . . . . . . . 17 101 6.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 17 102 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17 103 8. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 18 104 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 105 9.1. Normative References . . . . . . . . . . . . . . . . . . 21 106 9.2. Informative References . . . . . . . . . . . . . . . . . 21 107 Appendix A. Current Usage of Interfaces and Function Sets . . . 22 108 A.1. Constrained RESTful Environments (CoRE) Link Format 109 (IETF) . . . . . . . . . . . . . . . . . . . . . . . . . 23 110 A.2. CoRE Resource Directory (IETF) . . . . . . . . . . . . . 23 111 A.3. Open Connectivity Foundation (OCF) . . . . . . . . . . . 23 112 A.4. oneM2M . . . . . . . . . . . . . . . . . . . . . . . . . 24 113 A.5. OMA LWM2M . . . . . . . . . . . . . . . . . . . . . . . . 24 114 Appendix B. Resource Profile example . . . . . . . . . . . . . . 25 115 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 117 1. Introduction 119 IETF Standards for machine to machine communication in constrained 120 environments describe a REST protocol and a set of related 121 information standards that may be used to represent machine data and 122 machine metadata in REST interfaces. CoRE Link-format is a standard 123 for doing Web Linking [RFC5988] in constrained environments. SenML 124 [I-D.ietf-core-senml] is a simple data model and representation 125 format for composite and complex structured resources. CoRE Link- 126 Format and SenML can be used by CoAP [RFC7252] or HTTP servers. 128 The discovery of resources offered by a constrained server is very 129 important in machine-to-machine applications where there are no 130 humans in the loop. Machine application clients must be able to 131 adapt to different resource organizations without advance knowledge 132 of the specific data structures hosted by each connected thing. The 133 use of Web Linking for the description and discovery of resources 134 hosted by constrained web servers is specified by CoRE Link Format 135 [RFC6690]. CoRE Link Format additionally defines a link attribute 136 for interface description ("if") that can be used to describe the 137 REST interface of a resource, and may include a link to a description 138 document. 140 This document defines a set of Link Format interface descriptions for 141 some common design patterns that enable the server side composition 142 and organization, and client side discovery and consumption, of 143 machine resources using Web Linking. A client discovering the "if" 144 link attribute will be able to consume resources based on its 145 knowledge of the expected interface types. In this sense the 146 Interface Type acts in a similar way as a Content-Format, but as a 147 selector for a high level functional abstraction. 149 An interface description describes a resource in terms of its 150 associated content formats, data types, URI templates, REST methods, 151 parameters, and responses. Basic interface descriptions are defined 152 for sensors, and actuators. 154 A set of collection types is defined for organizing resources for 155 discovery, and for various forms of bulk interaction with resource 156 sets using typed embedding links. 158 This document first defines the concept of collection interface 159 descriptions. It then defines a number of generic interface 160 descriptions that may be used in contrained environments. Several of 161 these interface descriptions utilise collections. 163 Whilst this document assumes the use of CoAP [RFC7252], the REST 164 interfaces described can also be realized using HTTP [RFC7230]. 166 2. Terminology 168 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 169 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 170 "OPTIONAL" in this document are to be interpreted as described in 171 [RFC2119]. 173 This document requires readers to be familiar with all the terms and 174 concepts that are discussed in [RFC5988] and [RFC6690]. This 175 document makes use of the following additional terminology: 177 Gradual Reveal: A REST design where resources are discovered 178 progressively using Web Linking. 180 Interface Description: The Interface Description describes the 181 generic REST interface to interact with a resource or a set of 182 resources. Its use is described via the Interface Description 183 'if' attribute which is an opaque string used to provide a name or 184 URI indicating a specific interface definition used to interact 185 with the target resource. One can think of this as describing 186 verbs usable on a resource. 188 Resource Discovery: The process allowing a web client to identify 189 resources being hosted on a web server. 191 Service Discovery: The process making it possible for a web client 192 to automatically detect devices and Function Sets offered by these 193 devices on a CoRE network. 195 3. Collections 197 3.1. Introduction to Collections 199 A Collection is a resource which represents one or more related 200 resources. [RFC6573] describes the "item" and "collection" Link 201 Relation. "item" link relation identifies a member of collection. 202 "collection" indicates the collection that an item is a member of. 203 For example: A collection might be a resource representing catalog of 204 products, an item is a resource related to an individual product. 206 Section 1.2.2/[RFC6690] also describes resource collections. 208 This document uses the concept of "collection" and applies it to 209 interface descriptions. A collection interface description consists 210 of a set of links and a set of items pointed to by the links which 211 may be sub-resources of the collection resource. The collection 212 interface descriptions described in this document are Link List, 213 Batch and Linked Batch. 215 The links in a collection are represented in CoRE Link-Format 216 Content-Formats including JSON and CBOR variants, and the items in 217 the collection may be represented by senml, including JSON and CBOR 218 variants. In general, a collection may support items of any 219 available Content-Format. 221 A particular resource item may be a member of more than one 222 collection at a time by being linked to, but may only be a 223 subresource of one collection. 225 Some collections may have pre-configured items and links, and some 226 collections may support dynamic creation and removal of items and 227 links. Likewise, modification of items in some collections may be 228 permitted, and not in others. 230 Collections may support link embedding, which is analogous to an 231 image tag (link) causing the image to display inline in a browser 232 window. Resources pointed to by embedded links in collections may be 233 interacted with using bulk operations on the collection resource. 234 For example, performing a GET on a collection resource may return a 235 single representation containing all of the linked resources. 237 Links in collections may be selected for processing by a particular 238 request by using Query Filtering as described in CoRE Link-Format 239 [RFC6690]. 241 3.2. Use Cases for Collections 243 Collections may be used to provide gradual reveal of resources on an 244 endpoint. There may be a small set of links at the .well-known/core 245 location, which may in turn point to other collections of resources 246 that represent device information, device configuration, device 247 management, and various functional clusters of resources on the 248 device. 250 A collection may provide resource encapsulation, where link embedding 251 may be used to provide a single resource with which a client may 252 interact to obtain a set of related resource values. For example, a 253 collection for manufacturer parameters may consist of manufacturer 254 name, date of manufacture, location of manufacture, and serial number 255 resources which can be read as a single senml data object. 257 A collection may be used to group a set of like resources for bulk 258 state update or actuation. For example, the brightness control 259 resources of a number of luminaries may be grouped by linking to them 260 in a collection. The collection type may support receiving a single 261 update form a client and sending that update to each resource item in 262 the collection. 264 Items may be sub-resources of the collection resource. This enables 265 updates to multiple items in the collection to be processed together 266 within the context of the collection resource. 268 3.3. Content-Formats for Collections 270 The collection interfaces by default use CoRE Link-Format for the 271 link representations and SenML or text/plain for representations of 272 items. The examples given are for collections that expose resources 273 and links in these formats. In addition, a new "collection" Content- 274 Format is defined based on the SenML framework which represents both 275 links and items in the collection. 277 The choice of whether to return a representation of the links or of 278 the items or of the collection format is determined by the Accept 279 header option in the request. Likewise, the choice of updating link 280 metadata or item data or the collection resource itself is determined 281 by the Content-Format option in the header of the update request 282 operation. 284 The default Content-Formats for collection types described in this 285 document are: 287 Links: application/link-format, application/link-format+json 289 Items: application/senml+json, text/plain 291 3.4. Links and Items in Collections 293 Links use CoRE Link-Format representation by default and may point to 294 any resource reachable from the context of the collection. This 295 includes absolute links and links that point to other network 296 locations if the context of the collection allows. Links to sub- 297 resources in the collection MUST have a path-element starting with 298 the resource name, as per [RFC3986]. Links to resources in the 299 global context MUST start with a root path identifier [RFC5988]. 300 Links to other collections are formed per [RFC3986]. 302 Examples of links: 304 ;if="core.lb"': Link to the /sen/ collection describing it as 305 a core.lb type collection (Linked Batch) 307 ;rel="grp"': Link to the /sen/ collection indicating that 308 /sen/ is a member of a group in the collection in which the link 309 appears. 311 <"/sen/temp">;rt="temperature"': An absolute link to the resource at 312 the path /sen/temp 314 ;rt="temperature": Link to the temp subresource of the 315 collection in which this link appears." 317 ;anchor="/sen/": A link to the temp subresource of the 318 collection /sen/ which is assumed not to be a subresource of the 319 collection in which the link appears ,but is expected to be 320 identified in the collection by resource name. 322 Links in the collection MAY be Read, Updated, Added, or Removed using 323 the CoRE Link-Format or JSON Merge-Patch Content-Formats on the 324 collection resource. Reading links uses the GET method and returns 325 an array or list containing the link-values of all selected links. 326 Links may be added to the collection using POST or PATCH methods. 327 Updates to links MUST use the PATCH method and MAY use query 328 filtering to select links for updating. The PATCH method on links 329 MUST use the JSON Merge-Patch Content-Format (application/merge- 330 patch+json) specified in [RFC7396]. 332 Items in the collection SHOULD be represented using the SenML 333 (application/senml+json) or plain text (text/plain) Content-Formats, 334 depending on whether the representation is of a single data point or 335 multiple data points. Items MAY be represented using any supported 336 Content-Format. 338 Link Embedding enables the bulk processing of items in the collection 339 using a single operation targeting the collection resource. A subset 340 of resources in the collection may be selected for operation using 341 Query Filtering. Bulk Read operations using GET return a SenML 342 representation of all selected resources. Bulk item Update 343 operations using PUT or POST apply the payload document to all 344 selected resource items in the collection, using either a Batch or 345 Group update policy. A Batch update is performed by applying the 346 resource values in the payload document to all resources in the 347 collection that match any resource name in the payload document. 348 Group updates are performed by applying the payload document to each 349 item in the collection. Group updates are indicated by the link 350 relation type rel="grp" in the link. 352 3.5. Queries on Collections 354 Collections MAY support query filtering as defined in CoRE Link- 355 Format [RFC6690]. Operations targeting either the links or the items 356 MAY select a subset of links and items in the collection by using 357 query filtering. The Content-Format specified in the request header 358 selects whether links or items are targeted by the operation. 360 3.6. Observing Collections 362 Resource Observation via [I-D.ietf-core-dynlink] using CoAP [RFC7252] 363 MAY be supported on items in a collection. A subset of the 364 conditional observe parameters MAY be specified to apply. In most 365 cases pmin and pmax are useful. Resource observation on a 366 collection's items resource returns the collection representation. 367 Observation Responses, or notifications, SHOULD provide the 368 collection representations in SenML Content-Format. Notifications 369 MAY include multiple observations of the collection resource, with 370 SenML time stamps indicating the observation times. 372 3.7. Collection Types 374 There are three collection types defined in this document: 376 +-----------------+---------+--------------------+ 377 | Collection Type | if= | Content-Format | 378 +-----------------+---------+--------------------+ 379 | Link List | core.ll | link-format | 380 | | | | 381 | Batch | core.b | link-format, senml | 382 | | | | 383 | Linked Batch | core.lb | link-format, senml | 384 +-----------------+---------+--------------------+ 386 Table 1: Collection Type Summary 388 The interface description defined in this document describes the 389 methods and functions that may be applied to the collections. 391 4. Interface Descriptions 393 This section defines REST interfaces for Link List, Batch, Sensor, 394 Parameter and Actuator resources. Variants such as Linked Batch or 395 Read-Only Parameter are also presented. Each type is described along 396 with its Interface Description attribute value and valid methods. 397 These are defined for each interface in the table below. These 398 interfaces can support plain text and/or SenML Media types. 400 The if= column defines the Interface Description (if=) attribute 401 value to be used in the CoRE Link Format for a resource conforming to 402 that interface. When this value appears in the if= attribute of a 403 link, the resource MUST support the corresponding REST interface 404 described in this section. The resource MAY support additional 405 functionality, which is out of scope for this document. Although 406 these interface descriptions are intended to be used with the CoRE 407 Link Format, they are applicable for use in any REST interface 408 definition. 410 The Methods column defines the methods supported by that interface, 411 which are described in more detail below. 413 +--------------+---------+-----------------+--------------------+ 414 | Interface | if= | Methods | Content-Formats | 415 +--------------+---------+-----------------+--------------------+ 416 | Link List | core.ll | GET | link-format | 417 | | | | | 418 | Batch | core.b | GET, PUT, POST | link-format, senml | 419 | | | | | 420 | Linked Batch | core.lb | GET, PUT, POST, | link-format, senml | 421 | | | | | 422 | | | DELETE | | 423 | | | | | 424 | Sensor | core.s | GET | link-format, | 425 | | | | | 426 | | | | text/plain | 427 | | | | | 428 | Parameter | core.p | GET, PUT | link-format, | 429 | | | | | 430 | | | | text/plain | 431 | | | | | 432 | Read-only | core.rp | GET | link-format, | 433 | | | | | 434 | Parameter | | | text/plain | 435 | | | | | 436 | Actuator | core.a | GET, PUT, POST | link-format, | 437 | | | | | 438 | | | | text/plain | 439 +--------------+---------+-----------------+--------------------+ 441 Table 2: Interface Description Summary 443 The following is an example of links in the CoRE Link Format using 444 these interface descriptions. The resource hierarchy is based on a 445 simple resource profile defined in Appendix B. These links are used 446 in the subsequent examples below. 448 Req: GET /.well-known/core 449 Res: 2.05 Content (application/link-format) 450 ;rt="simple.sen";if="core.b", 451 ;rt="simple.sen.lt";if="core.s", 452 ;rt="simple.sen.tmp";if="core.s";obs, 453 ;rt="simple.sen.hum";if="core.s", 454 ;rt="simple.act";if="core.b", 455 ;rt="simple.act.led";if="core.a", 456 ;rt="simple.act.led";if="core.a", 457 ;rt="simple.dev";if="core.ll", 458 ;if="core.lb", 460 Figure 1: Binding Interface Example 462 4.1. Link List 464 The Link List interface is used to retrieve (GET) a list of resources 465 on a web server. The GET request SHOULD contain an Accept option 466 with the application/link-format content format. However if the 467 resource does not support any other form of content-format the Accept 468 option MAY be elided. 470 Note: The use of an Accept option with application/link-format is 471 recommended even though it is not strictly needed for the link list 472 interface because this interface is extended by the batch and linked 473 batch interfaces where different content-formats are possible. 475 The request returns a list of URI references with absolute paths to 476 the resources as defined in CoRE Link Format. This interface is 477 typically used with a parent resource to enumerate sub-resources but 478 may be used to reference any resource on a web server. 480 Link List is the base interface to provide gradual reveal of 481 resources on a CoRE web server, hence the root resource of a Function 482 Set SHOULD implement this interface or an extension of this 483 interface. 485 The following example interacts with a Link List /d containing 486 Parameter sub-resources /d/name, /d/model. 488 Req: GET /d/ (Accept:application/link-format) 489 Res: 2.05 Content (application/link-format) 490 ;rt="simple.dev.n";if="core.p", 491 ;rt="simple.dev.mdl";if="core.rp" 493 4.2. Batch 495 The Batch interface is used to manipulate a collection of sub- 496 resources at the same time. The Batch interface description supports 497 the same methods as its sub-resources, and can be used to read (GET), 498 update (PUT) or apply (POST) the values of those sub-resource with a 499 single resource representation. The sub-resources of a Batch MAY be 500 heterogeneous, a method used on the Batch only applies to sub- 501 resources that support it. For example Sensor interfaces do not 502 support PUT, and thus a PUT request to a Sensor member of that Batch 503 would be ignored. A batch requires the use of SenML Media types in 504 order to support multiple sub-resources. 506 In addition, the Batch interface is an extension of the Link List 507 interface and in consequence MUST support the same methods. For 508 example: a GET with an Accept:application/link-format on a resource 509 utilizing the batch interface will return the sub-resource links. 511 The following example interacts with a Batch /s/ with Sensor sub- 512 resources /s/light, /s/temp and /s/humidity. 514 Req: GET /s/ 515 Res: 2.05 Content (application/senml+json) 516 {"e":[ 517 { "n": "light", "v": 123, "u": "lx" }, 518 { "n": "temp", "v": 27.2, "u": "degC" }, 519 { "n": "humidity", "v": 80, "u": "%RH" }], 520 } 522 4.3. Linked Batch 524 The Linked Batch interface is an extension of the Batch interface. 525 Contrary to the basic Batch which is a collection statically defined 526 by the web server, a Linked Batch is dynamically controlled by a web 527 client. A Linked Batch resource has no sub-resources. Instead the 528 resources forming the batch are referenced using Web Linking 529 [RFC5988] and the CoRE Link Format [RFC6690]. A request with a POST 530 method and a content format of application/link-format simply appends 531 new resource links to the collection. The links in the payload MUST 532 reference a resource on the web server with an absolute path. A 533 DELETE request removes the entire collection. All other requests 534 available for a basic Batch are still valid for a Linked Batch. 536 The following example interacts with a Linked Batch /l/ and creates a 537 collection containing /s/light, /s/temp and /s/humidity in 2 steps. 539 Req: POST /l/ (Content-Format: application/link-format) 540 , 541 Res: 2.04 Changed 543 Req: GET /l/ 544 Res: 2.05 Content (application/senml+json) 545 {"e":[ 546 { "n": "/s/light", "v": 123, "u": "lx" }, 547 { "n": "/s/temp", "v": 27.2, "u": "degC" }, 548 } 550 Req: POST /l/ (Content-Format: application/link-format) 551 552 Res: 2.04 Changed 554 Req: GET /l/ (Accept: application/link-format) 555 Res: 2.05 Content (application/link-format) 556 ,, 558 Req: GET /l/ 559 Res: 2.05 Content (application/senml+json) 560 {"e":[ 561 { "n": "/s/light", "v": 123, "u": "lx" }, 562 { "n": "/s/temp", "v": 27.2, "u": "degC" }, 563 { "n": "/s/humidity", "v": 80, "u": "%RH" }], 564 } 566 Req: DELETE /l/ 567 Res: 2.02 Deleted 569 4.4. Sensor 571 The Sensor interface allows the value of a sensor resource to be read 572 (GET). The Media type of the resource can be either plain text or 573 SenML. Plain text MAY be used for a single measurement that does not 574 require meta-data. For a measurement with meta-data such as a unit 575 or time stamp, SenML SHOULD be used. A resource with this interface 576 MAY use SenML to return multiple measurements in the same 577 representation, for example a list of recent measurements. 579 The following are examples of Sensor interface requests in both text/ 580 plain and application/senml+json. 582 Req: GET /s/humidity (Accept: text/plain) 583 Res: 2.05 Content (text/plain) 584 80 586 Req: GET /s/humidity (Accept: application/senml+json) 587 Res: 2.05 Content (application/senml+json) 588 {"e":[ 589 { "n": "humidity", "v": 80, "u": "%RH" }], 590 } 592 4.5. Parameter 594 The Parameter interface allows configurable parameters and other 595 information to be modeled as a resource. The value of the parameter 596 can be read (GET) or update (PUT). Plain text or SenML Media types 597 MAY be returned from this type of interface. 599 The following example shows request for reading and updating a 600 parameter. 602 Req: GET /d/name 603 Res: 2.05 Content (text/plain) 604 node5 606 Req: PUT /d/name (text/plain) 607 outdoor 608 Res: 2.04 Changed 610 4.6. Read-only Parameter 612 The Read-only Parameter interface allows configuration parameters to 613 be read (GET) but not updated. Plain text or SenML Media types MAY 614 be returned from this type of interface. 616 The following example shows request for reading such a parameter. 618 Req: GET /d/model 619 Res: 2.05 Content (text/plain) 620 SuperNode200 622 4.7. Actuator 624 The Actuator interface is used by resources that model different 625 kinds of actuators (changing its value has an effect on its 626 environment). Examples of actuators include for example LEDs, 627 relays, motor controllers and light dimmers. The current value of 628 the actuator can be read (GET) or the actuator value can be updated 629 (PUT). In addition, this interface allows the use of POST to change 630 the state of an actuator, for example to toggle between its possible 631 values. Plain text or SenML Media types MAY be returned from this 632 type of interface. A resource with this interface MAY use SenML to 633 include multiple measurements in the same representation, for example 634 a list of recent actuator values or a list of values to updated. 636 The following example shows requests for reading, setting and 637 toggling an actuator (turning on a LED). 639 Req: GET /a/1/led 640 Res: 2.05 Content (text/plain) 641 0 643 Req: PUT /a/1/led (text/plain) 644 1 645 Res: 2.04 Changed 647 Req: POST /a/1/led (text/plain) 648 Res: 2.04 Changed 650 Req: GET /a/1/led 651 Res: 2.05 Content (text/plain) 652 0 654 5. Security Considerations 656 An implementation of a client needs to be prepared to deal with 657 responses to a request that differ from what is specified in this 658 document. A server implementing what the client thinks is a resource 659 with one of these interface descriptions could return malformed 660 representations and response codes either by accident or maliciously. 661 A server sending maliciously malformed responses could attempt to 662 take advantage of a poorly implemented client for example to crash 663 the node or perform denial of service. 665 6. IANA Considerations 667 This document registers the following CoRE Interface Description 668 (if=) Link Target Attribute Values. 670 6.1. Link List 672 Attribute Value: core.ll 674 Description: The Link List interface is used to retrieve a list of 675 resources on a web server. 677 Reference: This document. Note to RFC Editor - please insert the 678 appropriate RFC reference. 680 Notes: None 682 6.2. Batch 684 Attribute Value: core.b 686 Description: The Batch interface is used to manipulate a collection 687 of sub-resources at the same time. 689 Reference: This document. Note to RFC Editor - please insert the 690 appropriate RFC reference. 692 Notes: None 694 6.3. Linked Batch 696 Attribute Value: core.lb 698 Description: The Linked Batch interface is an extension of the Batch 699 interface. Contrary to the basic Batch which is a collection 700 statically defined by the web server, a Linked Batch is 701 dynamically controlled by a web client. 703 Reference: This document. Note to RFC Editor - please insert the 704 appropriate RFC reference. 706 Notes: None 708 6.4. Sensor 710 Attribute Value: core.s 712 Description: The Sensor interface allows the value of a sensor 713 resource to be read. 715 Reference: This document. Note to RFC Editor - please insert the 716 appropriate RFC reference. 718 Notes: None 720 6.5. Parameter 722 Attribute Value: core.p 723 Description: The Parameter interface allows configurable parameters 724 and other information to be modeled as a resource. The value of 725 the parameter can be read or update. 727 Reference: This document. Note to RFC Editor - please insert the 728 appropriate RFC reference. 730 Notes: None 732 6.6. Read-only parameter 734 Attribute Value: core.rp 736 Description: The Read-only Parameter interface allows configuration 737 parameters to be read but not updated. 739 Reference: This document. Note to RFC Editor - please insert the 740 appropriate RFC reference. 742 Notes: None 744 6.7. Actuator 746 Attribute Value: core.a 748 Description: The Actuator interface is used by resources that model 749 different kinds of actuators (changing its value has an effect on 750 its environment). Examples of actuators include for example LEDs, 751 relays, motor controllers and light dimmers. The current value of 752 the actuator can be read or the actuator value can be updated. In 753 addition, this interface allows the use of POST to change the 754 state of an actuator, for example to toggle between its possible 755 values. 757 Reference: This document. Note to RFC Editor - please insert the 758 appropriate RFC reference. 760 Notes: None 762 7. Acknowledgements 764 Acknowledgement is given to colleagues from the SENSEI project who 765 were critical in the initial development of the well-known REST 766 interface concept, to members of the IPSO Alliance where further 767 requirements for interface descriptions have been discussed, and to 768 Szymon Sasin, Cedric Chauvenet, Daniel Gavelle and Carsten Bormann 769 who have provided useful discussion and input to the concepts in this 770 document. 772 8. Changelog 774 Changes from -10 to 09: 776 o Section 1: Amendments to remove discussing properties. 778 o 780 o New author and editor added. 782 Changes from -08 to 09: 784 o Section 3.6: Modified to indicate that the entire collection 785 resource is returned. 787 o General: Added editor's note with open issues. 789 Changes from -07 to 08: 791 o Section 3.3: Modified Accepts to Accept header option. 793 o Addressed the editor's note in Section 4.1 to clarify the use of 794 the Accept option. 796 Changes from -06 to 07: 798 o Corrected Figure 1 sub-resource names e.g. tmp to temp and hum to 799 humidity. 801 o Addressed the editor's note in Section 4.2. 803 o Removed section on function sets and profiles as agreed to at the 804 IETF#97. 806 Changes from -05 to -06: 808 o Updated the abstract. 810 o Section 1: Updated introduction. 812 o Section 2: Alphabetised the order 814 o Section 2: Removed the collections definition in favour of the 815 complete definition in the collections section. 817 o Removed section 3 on interfaces in favour of an updated definition 818 in section 1.3. 820 o General: Changed interface type to interface description as that 821 is the term defined in RFC6690. 823 o Removed section on future interfaces. 825 o Section 8: Updated IANA considerations. 827 o Added Appendix A to discuss current state of the art wrt to 828 collections, function sets etc. 830 Changes from -04 to -05: 832 o Removed Link Bindings and Observe attributes. This functionality 833 is now contained in I-D.ietf-core-dynlink. 835 o Hypermedia collections have been removed. This is covered in a 836 new T2TRG draft. 838 o The WADL description has been removed. 840 o Fixed minor typos. 842 o Updated references. 844 Changes from -03 to -04: 846 o Fixed tickets #385 and #386. 848 o Changed abstract and into to better describe content. 850 o Focus on Interface and not function set/profiles in intro. 852 o Changed references from draft-core-observe to RFC7641. 854 o Moved Function sets and Profiles to section after Interfaces. 856 o Moved Observe Attributes to the Link Binding section. 858 o Add a Collection section to describe the collection types. 860 o Add the Hypermedia Collection Interface Description. 862 Changes from -02 to -03: 864 o Added lt and gt to binding format section. 866 o Added pmin and pmax observe parameters to Observation Attributes. 868 o Changed the definition of lt and gt to limit crossing. 870 o Added definitions for getattr and setattr to WADL. 872 o Added getattr and setattr to observable interfaces. 874 o Removed query parameters from Observe definition. 876 o Added observe-cancel definition to WADL and to observable 877 interfaces. 879 Changes from -01 to -02: 881 o Updated the date and version, fixed references. 883 o "Removed pmin and pmax observe parameters "[Ticket #336]"." 885 Changes from -00 to WG Document -01 887 o Improvements to the Function Set section. 889 Changes from -05 to WG Document -00 891 o Updated the date and version. 893 Changes from -04 to -05 895 o Made the Observation control parameters to be treated as resources 896 rather than Observe query parameters. Added Less Than and Greater 897 Than parameters. 899 Changes from -03 to -04 901 o Draft refresh 903 Changes from -02 to -03 905 o Added Bindings 907 o Updated all rt= and if= for the new Link Format IANA rules 909 Changes from -01 to -02 911 o Defined a Function Set and its guidelines. 913 o Added the Link List interface. 915 o Added the Linked Batch interface. 917 o Improved the WADL interface definition. 919 o Added a simple profile example. 921 9. References 923 9.1. Normative References 925 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 926 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 927 RFC2119, March 1997, . 930 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, DOI 10.17487/ 931 RFC5988, October 2010, . 934 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 935 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 936 . 938 9.2. Informative References 940 [I-D.ietf-core-dynlink] 941 Shelby, Z., Vial, M., Koster, M., and C. Groves, "Dynamic 942 Resource Linking for Constrained RESTful Environments", 943 draft-ietf-core-dynlink-03 (work in progress), March 2017. 945 [I-D.ietf-core-resource-directory] 946 Shelby, Z., Koster, M., Bormann, C., Stok, P., and C. 947 Amsuess, "CoRE Resource Directory", draft-ietf-core- 948 resource-directory-11 (work in progress), July 2017. 950 [I-D.ietf-core-senml] 951 Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C. 952 Bormann, "Media Types for Sensor Measurement Lists 953 (SenML)", draft-ietf-core-senml-10 (work in progress), 954 July 2017. 956 [OIC-Core] 957 "OIC Resource Type Specification v1.1.0", 2016, 958 . 960 [OIC-SmartHome] 961 "OIC Smart Home Device Specification v1.1.0", 2016, 962 . 964 [OMA-TS-LWM2M] 965 "Lightweight Machine to Machine Technical Specification", 966 2016, . 970 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 971 Resource Identifier (URI): Generic Syntax", STD 66, RFC 972 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", RFC 981 7230, DOI 10.17487/RFC7230, June 2014, . 984 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 985 Application Protocol (CoAP)", RFC 7252, DOI 10.17487/ 986 RFC7252, June 2014, . 989 [RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396, 990 DOI 10.17487/RFC7396, October 2014, . 993 [oneM2MTS0008] 994 "TS 0008 v1.3.2 CoAP Protocol Binding", 2016, 995 . 997 [oneM2MTS0023] 998 "TS 0023 v2.0.0 Home Appliances Information Model and 999 Mapping", 2016, 1000 . 1002 Appendix A. Current Usage of Interfaces and Function Sets 1004 Editor's note: This appendix will be removed. It is only included 1005 for information. 1007 This appendix analyses the current landscape with regards the 1008 definition and use of collections, interfaces and function sets/ 1009 profiles. This should be considered when considering the scope of 1010 this document. 1012 In summary it can be seen that there is a lack of consistency of the 1013 definition and usage of interface description and function sets. 1015 A.1. Constrained RESTful Environments (CoRE) Link Format (IETF) 1017 [RFC6690] assumes that different deployments or application domains 1018 will define the appropriate REST Interface Descriptions along with 1019 Resource Types to make discovery meaningful. It highlights that 1020 collections are often used for these interfaces. 1022 Whilst 3.2/[RFC6690] defines a new Interface Description 'if' 1023 attribute the procedures around it are about the naming of the 1024 interface not what information should be included in the 1025 documentation about the interface. 1027 Function sets are not discussed. 1029 A.2. CoRE Resource Directory (IETF) 1031 [I-D.ietf-core-resource-directory] uses the concepts of collections, 1032 interfaces and function sets. 1034 If defines a number of interfaces: discovery, registration, 1035 registration update, registration removal, read endpoint links, 1036 update endpoint links, registration request interface, removal 1037 request interface and lookup interface. However it does not assign 1038 an interface description identifier (if=) to these interfaces. 1040 It does define a resource directory function set which specifies 1041 relevant content formats and interfaces to be used between a resource 1042 directory and endpoints. However it does not follow the format 1043 proposed by this document. 1045 A.3. Open Connectivity Foundation (OCF) 1047 The OIC Core Specification [OIC-Core] most closely aligns with the 1048 work in this specification. It makes use of interface descriptions 1049 as per [RFC6690] and has registered several interface identifiers 1050 (https://www.iana.org/assignments/core-parameters/core- 1051 parameters.xhtml#if-link-target-att-value). These interface 1052 descriptors are similar to those defined in this specification. From 1053 a high level perspective: 1055 links list: OCF (oic.if.ll) -> IETF (core.ll) 1056 Note: it's called "link list" in the IETF. 1057 linked batch: OCF (oic.if.b) -> IETF (core.lb) 1058 read-only: OCF (oic.if.r) -> IETF (core.rp) 1059 read-write: OCF (oic.if.rw) -> IETF (core.p) 1060 actuator: OCF (oic.if.a) -> IETF (core.a) 1061 sensor: OCF (oic.if.s) -> IETF (core.s) 1062 batch: No OCF equivalent -> IETF (core.b) 1064 Some of the OCF interfaces make use of collections. 1066 The OIC Core specification does not use the concept of function sets. 1067 It does however discuss the concept of profiles. The OCF defines two 1068 sets of documents. The core specification documents such as 1069 [OIC-Core] and vertical profile specification documents which provide 1070 specific information for specific applications. The OIC Smart Home 1071 Device Specification [OIC-SmartHome] is one such specification. It 1072 provides information on the resource model, discovery and data types. 1074 A.4. oneM2M 1076 OneM2M describes a technology independent functional architecture 1077 [oneM2MTS0023]. In this archictecture the reference points between 1078 functional entities are called "interfaces". This usage does not 1079 match the [RFC6690] concept of interfaces. A more direct comparison 1080 is that of 10.2/[oneM2MTS0023] that defines basic procedures and 1081 resource type-specific procedures utilising REST type create, 1082 retrieve, update, delete, notify actions. 1084 [oneM2MTS0023] does not refer to resource collections however does 1085 define "Group Management Procedures" in 10.2.7/[oneM2MTS0023]. It 1086 does allow bulk management of member resources. 1088 [oneM2MTS0023] does not use the term "function set". [oneM2MTS0008] 1089 describes the binding with the CoAP protocol. In some respects this 1090 document provides a profile of the CoAP protocol in terms of the 1091 protocol elements that need to be supported. However it does not 1092 define any interface descriptions nor collections. 1094 A.5. OMA LWM2M 1096 [OMA-TS-LWM2M] utilises the concept of interfaces. It defines the 1097 following interfaces: Bootstrap, Client Registration, Device 1098 Management and Service Enablement and Information Reporting. It 1099 defines that these have a particular direction (Uplink/Downlink) and 1100 indicates the operations that may be applied to the interface (i.e. 1101 Request Bootstrap, Write, Delete, Register, Update, De-Register, 1102 Create, Read, Write, Delete, Execute, Write Attributes, Discover, 1103 Observe, Cancel Observation, Notify). It then further defines which 1104 objects may occur over the interface. In 6/[OMA-TS-LWM2M] resource 1105 model, identifier and data formats are described. 1107 Whilst it does not formally describe the use of "collections" the use 1108 of a multiple resource TLV allows a hierarchy of resource/sub- 1109 resource. 1111 It does not identify the interfaces through an Interface Description 1112 (if=) attribute. 1114 It does not use the term function set. Informally the specification 1115 could be considered as a function set. 1117 Note: It refers to draft-ietf-core-interfaces-00. It also makes use 1118 of the binding/observation attributes from draft-ietf-dynlink-00 but 1119 does not refer to that document. 1121 Appendix B. Resource Profile example 1123 The following is a short definition of simple device resource 1124 profile. This simplistic profile is for use in the examples of this 1125 document. 1127 +--------------------+-----------+------------+---------+ 1128 | Functions | Root Path | RT | IF | 1129 +--------------------+-----------+------------+---------+ 1130 | Device Description | /d | simple.dev | core.ll | 1131 | | | | | 1132 | Sensors | /s | simple.sen | core.b | 1133 | | | | | 1134 | Actuators | /a | simple.act | core.b | 1135 +--------------------+-----------+------------+---------+ 1137 Table 3: Functional list of resources 1139 +-------+----------+----------------+---------+------------+ 1140 | Type | Path | RT | IF | Data Type | 1141 +-------+----------+----------------+---------+------------+ 1142 | Name | /d/name | simple.dev.n | core.p | xsd:string | 1143 | | | | | | 1144 | Model | /d/model | simple.dev.mdl | core.rp | xsd:string | 1145 +-------+----------+----------------+---------+------------+ 1147 Table 4: Device Description Resources 1149 +-------------+-------------+----------------+--------+-------------+ 1150 | Type | Path | RT | IF | Data Type | 1151 +-------------+-------------+----------------+--------+-------------+ 1152 | Light | /s/light | simple.sen.lt | core.s | xsd:decimal | 1153 | | | | | | 1154 | | | | | (lux) | 1155 | | | | | | 1156 | Humidity | /s/humidity | simple.sen.hum | core.s | xsd:decimal | 1157 | | | | | | 1158 | | | | | (%RH) | 1159 | | | | | | 1160 | Temperature | /s/temp | simple.sen.tmp | core.s | xsd:decimal | 1161 | | | | | | 1162 | | | | | (degC) | 1163 +-------------+-------------+----------------+--------+-------------+ 1165 Table 5: Sensor Resources 1167 +------+------------+----------------+--------+-------------+ 1168 | Type | Path | RT | IF | Data Type | 1169 +------+------------+----------------+--------+-------------+ 1170 | LED | /a/{#}/led | simple.act.led | core.a | xsd:boolean | 1171 +------+------------+----------------+--------+-------------+ 1173 Table 6: Actuator Resources 1175 Authors' Addresses 1177 Zach Shelby 1178 ARM 1179 150 Rose Orchard 1180 San Jose 95134 1181 FINLAND 1183 Phone: +1-408-203-9434 1184 Email: zach.shelby@arm.com 1186 Matthieu Vial 1187 Schneider-Electric 1188 Grenoble 1189 FRANCE 1191 Phone: +33 (0)47657 6522 1192 Email: matthieu.vial@schneider-electric.com 1193 Michael Koster 1194 SmartThings 1195 665 Clyde Avenue 1196 Mountain View 94043 1197 USA 1199 Email: michael.koster@smartthings.com 1201 Christian Groves 1202 Australia 1204 Email: cngroves.std@gmail.com 1206 Julian Zhu 1207 Huawei 1208 No.127 Jinye Road, Huawei Base, High-Tech Development District 1209 Xi'an, Shaanxi Province 1210 China 1212 Email: jintao.zhu@huawei.com 1214 Bilhanan Silverajan (editor) 1215 Tampere University of Technology 1216 Korkeakoulunkatu 10 1217 Tampere FI-33720 1218 Finland 1220 Email: bilhanan.silverajan@tut.fi