idnits 2.17.1 draft-bormann-core-links-json-02.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 25, 2013) is 4071 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'I-D.ietf-core-coap' is defined on line 222, but no explicit reference was found in the text ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 5988 (Obsoleted by RFC 8288) == Outdated reference: A later version (-18) exists of draft-ietf-core-coap-13 Summary: 2 errors (**), 0 flaws (~~), 3 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Working Group C. Bormann 3 Internet-Draft Universitaet Bremen TZI 4 Intended status: Standards Track February 25, 2013 5 Expires: August 29, 2013 7 Representing CoRE Link Collections in JSON 8 draft-bormann-core-links-json-02 10 Abstract 12 Web Linking (RFC5988) provides a way to represent links between Web 13 resources as well as the relations expressed by them and attributes 14 of such a link. In constrained networks, a collection of Web links 15 can be exchanged in the CoRE link format (RFC6690). Outside of 16 constrained environments, it may be useful to represent these 17 collections of Web links in JSON format (RFC4627). 19 This specification defines a common format for representing Web links 20 in JSON format. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at http://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on August 29, 2013. 39 Copyright Notice 41 Copyright (c) 2013 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (http://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 57 1.1. Objectives . . . . . . . . . . . . . . . . . . . . . . . 2 58 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 59 2. Web Links in JSON . . . . . . . . . . . . . . . . . . . . . . 3 60 2.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 4 61 3. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 62 4. Security Considerations . . . . . . . . . . . . . . . . . . . 5 63 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 5 64 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 65 6.1. Normative References . . . . . . . . . . . . . . . . . . 5 66 6.2. Informative References . . . . . . . . . . . . . . . . . 5 67 Appendix A. Implementation . . . . . . . . . . . . . . . . . . . 6 68 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 6 70 1. Introduction 72 Web Linking [RFC5988] provides a way to represent links between Web 73 resources as well as the relations expressed by them and attributes 74 of such a link. In constrained networks, a collection of Web links 75 can be exchanged in the CoRE link format [RFC6690] to enable resource 76 discovery. 78 Outside of constrained environments, it may also be useful to 79 represent the same collections of Web links in the widely used JSON 80 format [RFC4627]. When converting between these two formats, as 81 usual, there are many little decisions that have to be made. If left 82 without guidance, it is likely that a number of slightly incompatible 83 dialects will emerge. 85 This specification defines a common format for representing CoRE Web 86 Linking in JSON format. 88 Note that there is a separate question on how to represent Web links 89 out of JSON documents, as discussed e.g. in [MNOT11]. While there 90 are good reasons to stay as compatible as possible to developments in 91 this area, the present specification is solving a different problem. 93 1.1. Objectives 95 (TBD: Convert the shopping list into plaintext) 96 o Canonical mapping 98 * lossless round-tripping 100 * but not trying for bit-preserving (DER-style) round-tripping 102 o The simplest thing that could possibly work 104 * Do not cater for RFC 5988 complications caused by HTTP header 105 character set issues [RFC2047] 107 o Consider other work that has links in JSON, e.g.: JSON-LD, JSON- 108 Reference [I-D.pbryan-zyp-json-ref] 110 * Do not introduce unmotivated differences 112 1.2. Terminology 114 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 115 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 116 document are to be interpreted as described in [RFC2119] when they 117 appear in ALL CAPS. These words may also appear in this document in 118 lower case as plain English words, absent their normative meanings. 120 2. Web Links in JSON 122 The objective of the JSON mapping defined in this document is to 123 contain information of the formats specified in [RFC5988] and 124 [RFC6690]. This specification therefore uses the names of the ABNF 125 productions used in those documents. 127 An application/link-format document is a collection of web links 128 ("link-value"), each of which is a collection of attributes ("link- 129 param") applied to a "URI-Reference". 131 We straightforwardly map: 133 o the outer collection to an array of links 135 o each link to a JSON object. 137 In the object representing a "link-value", each target attribute or 138 other parameter ("link-param") is represented by a JSON name/value 139 pair (member). The name is a string representation of the parameter 140 or attribute name (as in "parmname"), the value is a string 141 representation of the parameter or attribute value ("ptoken" or 142 "quoted-string"). "quoted-string" productions are parsed (i.e, the 143 backslash constructions evaluated) as defined in [RFC6690] and its 144 referenced documents, before placing them in JSON strings (where they 145 may gain back additional decorations such as backslashes as defined 146 in [RFC4627]). 148 If a Link attribute ("parmname") is present more than once in a 149 "link-value", its values are then represented as a JSON array of JSON 150 string values; this array becomes the value of the JSON name/value 151 pair where the attribute name is the JSON name. Attributes occurring 152 just once MUST NOT be represented as JSON arrays but MUST be directly 153 represented as JSON strings. (Note that the most recent version of 154 link-format has cut down on the use of repeated parameter names; they 155 are still allowed by [RFC5988] though. No attempt has been made to 156 decode the possibly space-separated values for rt=, if=, and rel= 157 into JSON arrays.) 159 The URI-Reference is represented as a name/value pair with the name 160 "href" and the URI-Reference as the value. (Rationale: This usage is 161 consistent with the use of "href" as a query parameter for link- 162 format query filtering and with link-format reserving the link 163 parameter "href" specifically for this use [RFC6690]). 165 (TBD: Should we do something special with the "hosts" relation? 166 Should we include an anchor where the link-format does not explicitly 167 set one?) 169 2.1. Examples 171 ;ct=40;title="Sensor Index", 172 ;rt="temperature-c";if="sensor", 173 ;rt="light-lux";if="sensor", 174 ;anchor="/sensors/temp" 175 ;rel="describedby", 176 ;anchor="/sensors/temp";rel="alternate" 178 Figure 1: Example from page 15 of [RFC6690] 180 becomes 182 "[{"href":"/sensors","ct":"40","title":"Sensor Index"},{"href":"/ 183 sensors/temp","rt":"temperature-c","if":"sensor"},{"href":"/sensors/ 184 light","rt":"light-lux","if":"sensor"},{"href":"http:// 185 www.example.com/sensors/t123","anchor":"/sensors/ 186 temp","rel":"describedby"},{"href":"/t","anchor":"/sensors/ 187 temp","rel":"alternate"}] " 189 (More examples to be added.) 191 3. IANA Considerations 193 (TBD. All the Media Type boilerplate, too, for:) 195 application/link-format+json 197 4. Security Considerations 199 (TBD.) 201 5. Acknowledgements 203 (TBD.) 205 6. References 207 6.1. Normative References 209 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 210 Requirement Levels", BCP 14, RFC 2119, March 1997. 212 [RFC4627] Crockford, D., "The application/json Media Type for 213 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 215 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, October 2010. 217 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 218 Format", RFC 6690, August 2012. 220 6.2. Informative References 222 [I-D.ietf-core-coap] 223 Shelby, Z., Hartke, K., Bormann, C., and B. Frank, 224 "Constrained Application Protocol (CoAP)", draft-ietf- 225 core-coap-13 (work in progress), December 2012. 227 [I-D.pbryan-zyp-json-ref] 228 Bryan, P. and K. Zyp, "JSON Reference", draft-pbryan-zyp- 229 json-ref-03 (work in progress), September 2012. 231 [MNOT11] Nottingham, M., "Linking in JSON", November 2011, 232 . 234 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 235 Part Three: Message Header Extensions for Non-ASCII Text", 236 RFC 2047, November 1996. 238 Appendix A. Implementation 240 This appendix provides a simple reference implementation of the 241 mapping between CoRE link format and Links-in-JSON. 243 (TBD - the reference implementation was used to create the above 244 examples, but I still have to clean it up for readability and paste 245 it in at 69 columns max.) 247 Author's Address 249 Carsten Bormann 250 Universitaet Bremen TZI 251 Postfach 330440 252 Bremen D-28359 253 Germany 255 Phone: +49-421-218-63921 256 Email: cabo@tzi.org