idnits 2.17.1 draft-ietf-core-interfaces-11.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([RFC6690]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 05, 2018) is 2244 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Outdated reference: A later version (-14) exists of draft-ietf-core-dynlink-04 == Outdated reference: A later version (-28) exists of draft-ietf-core-resource-directory-13 == Outdated reference: A later version (-16) exists of draft-ietf-core-senml-13 -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 1 error (**), 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: September 6, 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 March 05, 2018 16 Reusable Interface Definitions for Constrained RESTful Environments 17 draft-ietf-core-interfaces-11 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 an 33 Interface Description atribute value to describe resources conforming 34 to a particular interface. 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 https://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 September 6, 2018. 58 Copyright Notice 60 Copyright (c) 2018 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 (https://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 . . . . . . . . . . . . . . . . 5 80 3.3. Content-Formats for Collections . . . . . . . . . . . . . 6 81 3.4. Link Embedding . . . . . . . . . . . . . . . . . . . . . 6 82 3.5. Links and Items in Collections . . . . . . . . . . . . . 7 83 3.6. Queries on Collections . . . . . . . . . . . . . . . . . 8 84 3.7. Observing Collections . . . . . . . . . . . . . . . . . . 8 85 3.8. Collection Types . . . . . . . . . . . . . . . . . . . . 8 86 4. Interface Descriptions . . . . . . . . . . . . . . . . . . . 9 87 4.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 11 88 4.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 11 89 4.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 12 90 4.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 13 91 4.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 14 92 4.6. Read-only Parameter . . . . . . . . . . . . . . . . . . . 14 93 4.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 14 94 5. Security Considerations . . . . . . . . . . . . . . . . . . . 15 95 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 96 6.1. Link List . . . . . . . . . . . . . . . . . . . . . . . . 15 97 6.2. Batch . . . . . . . . . . . . . . . . . . . . . . . . . . 16 98 6.3. Linked Batch . . . . . . . . . . . . . . . . . . . . . . 16 99 6.4. Sensor . . . . . . . . . . . . . . . . . . . . . . . . . 16 100 6.5. Parameter . . . . . . . . . . . . . . . . . . . . . . . . 16 101 6.6. Read-only parameter . . . . . . . . . . . . . . . . . . . 17 102 6.7. Actuator . . . . . . . . . . . . . . . . . . . . . . . . 17 103 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17 104 8. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 18 105 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 106 9.1. Normative References . . . . . . . . . . . . . . . . . . 21 107 9.2. Informative References . . . . . . . . . . . . . . . . . 21 108 Appendix A. Current Usage of Interfaces and Function Sets . . . 23 109 A.1. Constrained RESTful Environments (CoRE) Link Format 110 (IETF) . . . . . . . . . . . . . . . . . . . . . . . . . 23 111 A.2. CoRE Resource Directory (IETF) . . . . . . . . . . . . . 23 112 A.3. Open Connectivity Foundation (OCF) . . . . . . . . . . . 23 113 A.4. oneM2M . . . . . . . . . . . . . . . . . . . . . . . . . 24 114 A.5. OMA LWM2M . . . . . . . . . . . . . . . . . . . . . . . . 25 115 Appendix B. Resource Profile example . . . . . . . . . . . . . . 25 116 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 118 1. Introduction 120 IETF Standards for machine to machine communication in constrained 121 environments describe a REST protocol and a set of related 122 information standards that may be used to represent machine data and 123 machine metadata in REST interfaces. CoRE Link-format is a standard 124 for doing Web Linking [RFC8288] in constrained environments. SenML 125 [I-D.ietf-core-senml] is a simple data model and representation 126 format for composite and complex structured resources. CoRE Link- 127 Format and SenML can be used by CoAP [RFC7252] or HTTP servers. 129 The discovery of resources offered by a constrained server is very 130 important in machine-to-machine applications where there are no 131 humans in the loop. Machine application clients must be able to 132 adapt to different resource organizations without advance knowledge 133 of the specific data structures hosted by each connected thing. The 134 use of Web Linking for the description and discovery of resources 135 hosted by constrained origin servers is specified by CoRE Link Format 136 [RFC6690]. CoRE Link Format additionally defines a link attribute 137 for interface description ("if") that can be used to describe the 138 REST interface of a resource, and may include a link to a description 139 document. 141 This document defines a set of Link Format interface descriptions for 142 some common design patterns that enable the server side composition 143 and organization, and client side discovery and consumption, of 144 machine resources using Web Linking. A client discovering the "if" 145 link attribute will be able to consume resources based on its 146 knowledge of the expected interface types. In this sense the 147 Interface Type acts in a similar way as a Content-Format, but as a 148 selector for a high level functional abstraction. 150 An interface description describes a resource in terms of its 151 associated content formats, data types, URI templates, REST methods, 152 parameters, and responses. Basic interface descriptions are defined 153 for sensors, and actuators. 155 A set of collection types is defined for organizing resources for 156 discovery, and for various forms of bulk interaction with resource 157 sets using typed embedding links. 159 This document first defines the concept of collection interface 160 descriptions. It then defines a number of generic interface 161 descriptions that may be used in contrained environments. Several of 162 these interface descriptions utilise collections. 164 Whilst this document assumes the use of CoAP [RFC7252], the REST 165 interfaces described can also be realized using HTTP [RFC7230]. 167 2. Terminology 169 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 170 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 171 "OPTIONAL" in this document are to be interpreted as described in 172 [RFC2119]. 174 This document requires readers to be familiar with all the terms and 175 concepts that are discussed in [RFC8288] and [RFC6690]. This 176 document makes use of the following additional terminology: 178 Gradual Reveal: A REST design where resources are discovered 179 progressively using Web Linking. 181 Interface Description: The Interface Description describes the 182 generic REST interface to interact with a resource or a set of 183 resources. Its use is described via the Interface Description 184 'if' attribute which is an opaque string used to provide a name or 185 URI indicating a specific interface definition used to interact 186 with the target resource. One can think of this as describing 187 verbs usable on a resource. 189 Resource Discovery: The process allowing a client to identify 190 resources being hosted on an origin server. 192 3. Collections 194 3.1. Introduction to Collections 196 A Collection is a resource which represents one or more related 197 resources. [RFC6573] describes the "item" and "collection" Link 198 Relation. An "item" link relation identifies a member of collection. 199 A "collection" indicates the collection that an item is a member of. 200 For example, a collection might be a resource representing a catalog 201 of products, while an item is a resource related to an individual 202 product. 204 Section 1.2.2/[RFC6690] also describes resource collections. 206 This document uses the concept of "collection" and applies it to 207 interface descriptions. A collection interface description consists 208 of a set of links and a set of items pointed to by the links which 209 may be sub-resources of the collection resource. The collection 210 interface descriptions described in this document are Link List, 211 Batch and Linked Batch. 213 The links in a collection are represented in CoRE Link-Format 214 Content-Formats including JSON and CBOR variants, and the items in 215 the collection may be represented by senml, including JSON and CBOR 216 variants. In general, a collection may support items of any 217 available Content-Format. 219 A particular resource item may be a member of more than one 220 collection at a time by being linked to, but may only be a 221 subresource of one collection. 223 Some collections may have pre-configured items and links, and some 224 collections may support dynamic creation and removal of items and 225 links. Likewise, modification of items in some collections may be 226 permitted, and not in others. 228 Links in collections may be selected for processing by a particular 229 request by using Query Filtering as described in CoRE Link-Format 230 [RFC6690]. 232 3.2. Use Cases for Collections 234 Collections may be used to provide gradual reveal of resources on an 235 endpoint. There may be a small set of links at the .well-known/core 236 location, which may in turn point to other collections of resources 237 that represent device information, device configuration, device 238 management, and various functional clusters of resources on the 239 device. 241 A collection may be used to group a set of like resources for bulk 242 state update or actuation. For example, the brightness control 243 resources of a number of luminaries may be grouped by linking to them 244 in a collection. The collection type may support receiving a single 245 update from a client and sending that update to each resource item in 246 the collection. 248 Items may be sub-resources of the collection resource. This enables 249 updates to multiple items in the collection to be processed together 250 within the context of the collection resource. 252 3.3. Content-Formats for Collections 254 The collection interfaces by default use CoRE Link-Format for the 255 link representations and SenML or text/plain for representations of 256 items. The examples given are for collections that expose resources 257 and links in these formats. In addition, a new "collection" Content- 258 Format is defined based on the SenML framework which represents both 259 links and items in the collection. 261 The choice of whether to return a representation of the links or of 262 the items or of the collection format is determined by the Accept 263 header option in the request. Likewise, the choice of updating link 264 metadata or item data or the collection resource itself is determined 265 by the Content-Format option in the header of the update request 266 operation. 268 The default Content-Formats for collection types described in this 269 document are: 271 Links: application/link-format, application/link-format+json 273 Items: application/senml+json, text/plain 275 3.4. Link Embedding 277 Collections may provide resource encapsulation by supporting link 278 embedding. Link embedding may be used to provide a single resource 279 with which a client may interact to obtain a set of related resource 280 values. This is analogous to an image tag (link) causing the image 281 to display inline in a browser window. Link embedding enables the 282 bulk processing of items in the collection using a single operation 283 targeting the collection resource. Performing a GET on a collection 284 resource may return a single representation containing all of the 285 embedded linked resources. For example, a collection for 286 manufacturer parameters may consist of manufacturer name, date of 287 manufacture, location of manufacture, and serial number resources 288 which can be read as a single senml data object. 290 A subset of resources in the collection may be selected for operation 291 using Query Filtering. Bulk Read operations using GET return a SenML 292 representation of all selected resources. Bulk item Update 293 operations using PUT or POST apply the payload document to all 294 selected resource items in the collection, using either a Batch or 295 Group update policy. A Batch update is performed by applying the 296 resource values in the payload document to all resources in the 297 collection that match any resource name in the payload document. 298 Group updates are performed by applying the payload document to each 299 item in the collection. Group updates are indicated by the link 300 relation type rel="grp" in the link. 302 3.5. Links and Items in Collections 304 Links use CoRE Link-Format representation by default and may point to 305 any resource reachable from the context of the collection. This 306 includes links to resources with absolute paths as well as links that 307 point to other network locations, if the context of the collection 308 allows. Links to sub-resources in the collection MUST have a path- 309 element starting with the resource name, as per [RFC3986]. Links to 310 resources in the global context MUST start with a root path 311 identifier [RFC8288]. Links to other collections are formed per 312 [RFC3986]. 314 Examples of links: 316 ;if="core.lb": Link to the /sen/ collection describing it as 317 a core.lb type collection (Linked Batch) 319 ;rel="grp": Link to the /sen/ collection indicating that 320 /sen/ is a member of a group in the collection in which the link 321 appears. 323 ;rt="temperature": A link to the temp resource with an 324 absolute path. 326 ;rt="temperature": Link to the temp subresource of the 327 collection in which this link appears. 329 ;anchor="/sen/": A link to the temp subresource of the 330 collection /sen/ which is assumed not to be a subresource of the 331 collection in which the link appears, but is expected to be 332 identified in the collection by resource name. 334 Links in the collection MAY be Read, Updated, Added, or Removed using 335 the CoRE Link-Format or JSON Merge-Patch Content-Formats on the 336 collection resource. Reading links uses the GET method and returns 337 an array or list containing the link-values of all selected links. 339 Links may be added to the collection using POST or PATCH methods. 340 Updates to links MUST use the PATCH method and MAY use query 341 filtering to select links for updating. The PATCH method on links 342 MUST use the JSON Merge-Patch Content-Format (application/merge- 343 patch+json) specified in [RFC7396]. 345 Items in the collection SHOULD be represented using the SenML 346 (application/senml+json) or plain text (text/plain) Content-Formats, 347 depending on whether the representation is of a single data point or 348 multiple data points. Items MAY be represented using any supported 349 Content-Format. 351 3.6. Queries on Collections 353 Collections MAY support query filtering as defined in CoRE Link- 354 Format [RFC6690]. Operations targeting either the links or the items 355 MAY select a subset of links and items in the collection by using 356 query filtering. The Content-Format specified in the request header 357 selects whether links or items are targeted by the operation. 359 3.7. Observing Collections 361 Resource Observation via [I-D.ietf-core-dynlink] using CoAP [RFC7252] 362 MAY be supported on items in a collection. A subset of the 363 conditional observe parameters MAY be specified to apply. In most 364 cases pmin and pmax are useful. Resource observation on a 365 collection's resource returns the collection representation. 366 Observation Responses, or notifications, SHOULD provide the 367 collection representations in SenML Content-Format. Notifications 368 MAY include multiple observations of the collection resource, with 369 SenML time stamps indicating the observation times. 371 3.8. Collection Types 373 There are three collection types defined in this document: 375 +-----------------+---------+--------------------+ 376 | Collection Type | if= | Content-Format | 377 +-----------------+---------+--------------------+ 378 | Link List | core.ll | link-format | 379 | | | | 380 | Batch | core.b | link-format, senml | 381 | | | | 382 | Linked Batch | core.lb | link-format, senml | 383 +-----------------+---------+--------------------+ 385 Table 1: Collection Type Summary 387 The interface description defined in this document offer a deeper 388 explanation of the methods and functions that may be applied to the 389 three collections. 391 4. Interface Descriptions 393 This section defines REST interfaces for Sensor, Parameter, Read-Only 394 Paramter and Actuator resource types, in addition to the Link List, 395 Batch and Linked Batch collection types. Each type is described 396 along with its Interface Description attribute value, valid methods 397 and content formats. These are shown for each interface in the table 398 below. 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 an origin 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 an origin server. 480 Link List is the base interface to provide gradual reveal of 481 resources on a CoRE origin server. Hence the root resource of a 482 Function 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. Hence, a method used on the Batch only applies to 501 sub-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 origin server, a Linked Batch is dynamically controlled by a 527 client. A Linked Batch resource has no sub-resources. Instead the 528 resources forming the batch are referenced using Web Linking 529 [RFC8288] 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 origin 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 an origin 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 origin server, a Linked Batch is 701 dynamically controlled by a 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 11: 776 o New Section 3.4 on Link Embedding 778 o Removed disused "Service discovery" terminology 780 o Removed wording referring to discontinued function set concept 782 Changes from -09 to -10: 784 o Section 1: Amendments to remove discussing properties. 786 o New author and editor added. 788 Changes from -08 to -09: 790 o Section 3.6: Modified to indicate that the entire collection 791 resource is returned. 793 o General: Added editor's note with open issues. 795 Changes from -07 to -08: 797 o Section 3.3: Modified Accepts to Accept header option. 799 o Addressed the editor's note in Section 4.1 to clarify the use of 800 the Accept option. 802 Changes from -06 to -07: 804 o Corrected Figure 1 sub-resource names e.g. tmp to temp and hum to 805 humidity. 807 o Addressed the editor's note in Section 4.2. 809 o Removed section on function sets and profiles as agreed to at the 810 IETF#97. 812 Changes from -05 to -06: 814 o Updated the abstract. 816 o Section 1: Updated introduction. 818 o Section 2: Alphabetised the order 819 o Section 2: Removed the collections definition in favour of the 820 complete definition in the collections section. 822 o Removed section 3 on interfaces in favour of an updated definition 823 in section 1.3. 825 o General: Changed interface type to interface description as that 826 is the term defined in RFC6690. 828 o Removed section on future interfaces. 830 o Section 8: Updated IANA considerations. 832 o Added Appendix A to discuss current state of the art wrt to 833 collections, function sets etc. 835 Changes from -04 to -05: 837 o Removed Link Bindings and Observe attributes. This functionality 838 is now contained in I-D.ietf-core-dynlink. 840 o Hypermedia collections have been removed. This is covered in a 841 new T2TRG draft. 843 o The WADL description has been removed. 845 o Fixed minor typos. 847 o Updated references. 849 Changes from -03 to -04: 851 o Fixed tickets #385 and #386. 853 o Changed abstract and into to better describe content. 855 o Focus on Interface and not function set/profiles in intro. 857 o Changed references from draft-core-observe to RFC7641. 859 o Moved Function sets and Profiles to section after Interfaces. 861 o Moved Observe Attributes to the Link Binding section. 863 o Add a Collection section to describe the collection types. 865 o Add the Hypermedia Collection Interface Description. 867 Changes from -02 to -03: 869 o Added lt and gt to binding format section. 871 o Added pmin and pmax observe parameters to Observation Attributes. 873 o Changed the definition of lt and gt to limit crossing. 875 o Added definitions for getattr and setattr to WADL. 877 o Added getattr and setattr to observable interfaces. 879 o Removed query parameters from Observe definition. 881 o Added observe-cancel definition to WADL and to observable 882 interfaces. 884 Changes from -01 to -02: 886 o Updated the date and version, fixed references. 888 o "Removed pmin and pmax observe parameters "[Ticket #336]"." 890 Changes from -00 to WG Document -01 892 o Improvements to the Function Set section. 894 Changes from -05 to WG Document -00 896 o Updated the date and version. 898 Changes from -04 to -05 900 o Made the Observation control parameters to be treated as resources 901 rather than Observe query parameters. Added Less Than and Greater 902 Than parameters. 904 Changes from -03 to -04 906 o Draft refresh 908 Changes from -02 to -03 910 o Added Bindings 912 o Updated all rt= and if= for the new Link Format IANA rules 914 Changes from -01 to -02 915 o Defined a Function Set and its guidelines. 917 o Added the Link List interface. 919 o Added the Linked Batch interface. 921 o Improved the WADL interface definition. 923 o Added a simple profile example. 925 9. References 927 9.1. Normative References 929 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 930 Requirement Levels", BCP 14, RFC 2119, 931 DOI 10.17487/RFC2119, March 1997, 932 . 934 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 935 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 936 . 938 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 939 DOI 10.17487/RFC8288, October 2017, 940 . 942 9.2. Informative References 944 [I-D.ietf-core-dynlink] 945 Shelby, Z., Koster, M., Groves, C., Zhu, J., and B. 946 Silverajan, "Dynamic Resource Linking for Constrained 947 RESTful Environments", draft-ietf-core-dynlink-04 (work in 948 progress), September 2017. 950 [I-D.ietf-core-resource-directory] 951 Shelby, Z., Koster, M., Bormann, C., Stok, P., and C. 952 Amsuess, "CoRE Resource Directory", draft-ietf-core- 953 resource-directory-13 (work in progress), March 2018. 955 [I-D.ietf-core-senml] 956 Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C. 957 Bormann, "Media Types for Sensor Measurement Lists 958 (SenML)", draft-ietf-core-senml-13 (work in progress), 959 March 2018. 961 [OIC-Core] 962 "OIC Resource Type Specification v1.1.0", 2016, 963 . 965 [OIC-SmartHome] 966 "OIC Smart Home Device Specification v1.1.0", 2016, 967 . 969 [OMA-TS-LWM2M] 970 "Lightweight Machine to Machine Technical Specification", 971 2016, . 975 [oneM2MTS0008] 976 "TS 0008 v1.3.2 CoAP Protocol Binding", 2016, 977 . 979 [oneM2MTS0023] 980 "TS 0023 v2.0.0 Home Appliances Information Model and 981 Mapping", 2016, 982 . 984 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 985 Resource Identifier (URI): Generic Syntax", STD 66, 986 RFC 3986, DOI 10.17487/RFC3986, January 2005, 987 . 989 [RFC6573] Amundsen, M., "The Item and Collection Link Relations", 990 RFC 6573, DOI 10.17487/RFC6573, April 2012, 991 . 993 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 994 Protocol (HTTP/1.1): Message Syntax and Routing", 995 RFC 7230, DOI 10.17487/RFC7230, June 2014, 996 . 998 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 999 Application Protocol (CoAP)", RFC 7252, 1000 DOI 10.17487/RFC7252, June 2014, 1001 . 1003 [RFC7396] Hoffman, P. and J. Snell, "JSON Merge Patch", RFC 7396, 1004 DOI 10.17487/RFC7396, October 2014, 1005 . 1007 Appendix A. Current Usage of Interfaces and Function Sets 1009 Editor's note: This appendix will be removed. It is only included 1010 for information. 1012 This appendix analyses the current landscape with regards the 1013 definition and use of collections, interfaces and function sets/ 1014 profiles. This should be considered when considering the scope of 1015 this document. 1017 In summary it can be seen that there is a lack of consistency of the 1018 definition and usage of interface description and function sets. 1020 A.1. Constrained RESTful Environments (CoRE) Link Format (IETF) 1022 [RFC6690] assumes that different deployments or application domains 1023 will define the appropriate REST Interface Descriptions along with 1024 Resource Types to make discovery meaningful. It highlights that 1025 collections are often used for these interfaces. 1027 Whilst 3.2/[RFC6690] defines a new Interface Description 'if' 1028 attribute the procedures around it are about the naming of the 1029 interface not what information should be included in the 1030 documentation about the interface. 1032 Function sets are not discussed. 1034 A.2. CoRE Resource Directory (IETF) 1036 [I-D.ietf-core-resource-directory] uses the concepts of collections, 1037 interfaces and function sets. 1039 If defines a number of interfaces: discovery, registration, 1040 registration update, registration removal, read endpoint links, 1041 update endpoint links, registration request interface, removal 1042 request interface and lookup interface. However it does not assign 1043 an interface description identifier (if=) to these interfaces. 1045 It does define a resource directory function set which specifies 1046 relevant content formats and interfaces to be used between a resource 1047 directory and endpoints. However it does not follow the format 1048 proposed by this document. 1050 A.3. Open Connectivity Foundation (OCF) 1052 The OIC Core Specification [OIC-Core] most closely aligns with the 1053 work in this specification. It makes use of interface descriptions 1054 as per [RFC6690] and has registered several interface identifiers 1055 (https://www.iana.org/assignments/core-parameters/core- 1056 parameters.xhtml#if-link-target-att-value). These interface 1057 descriptors are similar to those defined in this specification. From 1058 a high level perspective: 1060 links list: OCF (oic.if.ll) -> IETF (core.ll) 1061 Note: it's called "link list" in the IETF. 1062 linked batch: OCF (oic.if.b) -> IETF (core.lb) 1063 read-only: OCF (oic.if.r) -> IETF (core.rp) 1064 read-write: OCF (oic.if.rw) -> IETF (core.p) 1065 actuator: OCF (oic.if.a) -> IETF (core.a) 1066 sensor: OCF (oic.if.s) -> IETF (core.s) 1067 batch: No OCF equivalent -> IETF (core.b) 1069 Some of the OCF interfaces make use of collections. 1071 The OIC Core specification does not use the concept of function sets. 1072 It does however discuss the concept of profiles. The OCF defines two 1073 sets of documents. The core specification documents such as 1074 [OIC-Core] and vertical profile specification documents which provide 1075 specific information for specific applications. The OIC Smart Home 1076 Device Specification [OIC-SmartHome] is one such specification. It 1077 provides information on the resource model, discovery and data types. 1079 A.4. oneM2M 1081 OneM2M describes a technology independent functional architecture 1082 [oneM2MTS0023]. In this archictecture the reference points between 1083 functional entities are called "interfaces". This usage does not 1084 match the [RFC6690] concept of interfaces. A more direct comparison 1085 is that of 10.2/[oneM2MTS0023] that defines basic procedures and 1086 resource type-specific procedures utilising REST type create, 1087 retrieve, update, delete, notify actions. 1089 [oneM2MTS0023] does not refer to resource collections however does 1090 define "Group Management Procedures" in 10.2.7/[oneM2MTS0023]. It 1091 does allow bulk management of member resources. 1093 [oneM2MTS0023] does not use the term "function set". [oneM2MTS0008] 1094 describes the binding with the CoAP protocol. In some respects this 1095 document provides a profile of the CoAP protocol in terms of the 1096 protocol elements that need to be supported. However it does not 1097 define any interface descriptions nor collections. 1099 A.5. OMA LWM2M 1101 [OMA-TS-LWM2M] utilises the concept of interfaces. It defines the 1102 following interfaces: Bootstrap, Client Registration, Device 1103 Management and Service Enablement and Information Reporting. It 1104 defines that these have a particular direction (Uplink/Downlink) and 1105 indicates the operations that may be applied to the interface (i.e. 1106 Request Bootstrap, Write, Delete, Register, Update, De-Register, 1107 Create, Read, Write, Delete, Execute, Write Attributes, Discover, 1108 Observe, Cancel Observation, Notify). It then further defines which 1109 objects may occur over the interface. In 6/[OMA-TS-LWM2M] resource 1110 model, identifier and data formats are described. 1112 Whilst it does not formally describe the use of "collections" the use 1113 of a multiple resource TLV allows a hierarchy of resource/sub- 1114 resource. 1116 It does not identify the interfaces through an Interface Description 1117 (if=) attribute. 1119 It does not use the term function set. Informally the specification 1120 could be considered as a function set. 1122 Note: It refers to draft-ietf-core-interfaces-00. It also makes use 1123 of the binding/observation attributes from draft-ietf-dynlink-00 but 1124 does not refer to that document. 1126 Appendix B. Resource Profile example 1128 The following is a short definition of simple device resource 1129 profile. This simplistic profile is for use in the examples of this 1130 document. 1132 +--------------------+-----------+------------+---------+ 1133 | Functions | Root Path | RT | IF | 1134 +--------------------+-----------+------------+---------+ 1135 | Device Description | /d | simple.dev | core.ll | 1136 | | | | | 1137 | Sensors | /s | simple.sen | core.b | 1138 | | | | | 1139 | Actuators | /a | simple.act | core.b | 1140 +--------------------+-----------+------------+---------+ 1142 Table 3: Functional list of resources 1144 +-------+----------+----------------+---------+------------+ 1145 | Type | Path | RT | IF | Data Type | 1146 +-------+----------+----------------+---------+------------+ 1147 | Name | /d/name | simple.dev.n | core.p | xsd:string | 1148 | | | | | | 1149 | Model | /d/model | simple.dev.mdl | core.rp | xsd:string | 1150 +-------+----------+----------------+---------+------------+ 1152 Table 4: Device Description Resources 1154 +-------------+-------------+----------------+--------+-------------+ 1155 | Type | Path | RT | IF | Data Type | 1156 +-------------+-------------+----------------+--------+-------------+ 1157 | Light | /s/light | simple.sen.lt | core.s | xsd:decimal | 1158 | | | | | | 1159 | | | | | (lux) | 1160 | | | | | | 1161 | Humidity | /s/humidity | simple.sen.hum | core.s | xsd:decimal | 1162 | | | | | | 1163 | | | | | (%RH) | 1164 | | | | | | 1165 | Temperature | /s/temp | simple.sen.tmp | core.s | xsd:decimal | 1166 | | | | | | 1167 | | | | | (degC) | 1168 +-------------+-------------+----------------+--------+-------------+ 1170 Table 5: Sensor Resources 1172 +------+------------+----------------+--------+-------------+ 1173 | Type | Path | RT | IF | Data Type | 1174 +------+------------+----------------+--------+-------------+ 1175 | LED | /a/{#}/led | simple.act.led | core.a | xsd:boolean | 1176 +------+------------+----------------+--------+-------------+ 1178 Table 6: Actuator Resources 1180 Authors' Addresses 1182 Zach Shelby 1183 ARM 1184 150 Rose Orchard 1185 San Jose 95134 1186 FINLAND 1188 Phone: +1-408-203-9434 1189 Email: zach.shelby@arm.com 1190 Matthieu Vial 1191 Schneider-Electric 1192 Grenoble 1193 FRANCE 1195 Phone: +33 (0)47657 6522 1196 Email: matthieu.vial@schneider-electric.com 1198 Michael Koster 1199 SmartThings 1200 665 Clyde Avenue 1201 Mountain View 94043 1202 USA 1204 Email: michael.koster@smartthings.com 1206 Christian Groves 1207 Australia 1209 Email: cngroves.std@gmail.com 1211 Julian Zhu 1212 Huawei 1213 No.127 Jinye Road, Huawei Base, High-Tech Development District 1214 Xi'an, Shaanxi Province 1215 China 1217 Email: jintao.zhu@huawei.com 1219 Bilhanan Silverajan (editor) 1220 Tampere University of Technology 1221 Korkeakoulunkatu 10 1222 Tampere FI-33720 1223 Finland 1225 Email: bilhanan.silverajan@tut.fi