Constrained RESTful Environments (CoRE) Link Format
Extracted elements (27)
In CoRE, the link collection is carried as a resource of its own at a well-known URI (as opposed to HTTP headers delivered with a specific resource), because the main use case is discovery of which resources a server hosts in the first place, not describing a resource after accessing it.
The CoRE Link Format does not require special XML or binary parsing, is fairly compact, and is extensible — all important characteristics for constrained nodes (e.g., 8-bit microcontrollers with limited memory) and constrained networks (e.g., 6LoWPANs).
The 'hosts' relation type is assumed as the default in the absence of the relation parameter, because links in CoRE Link Format are typically used to describe resources hosted by a server. This avoids requiring the rel= parameter in the common case.
The CoRE Link Format is encoded as UTF-8. A decoder is not expected to validate UTF-8 encoding and does not need to perform UTF-8 normalization; UTF-8 data can be compared bitwise.
The CoRE Link Format is equivalent to the RFC 5988 link format and reuses its serialization. To convert an HTTP Link Header field to this format: remove the 'Link:' header, remove linear whitespace, convert to UTF-8, and decode percent-encodings.
A server implementing this specification MUST support the '/.well-known/core' resource on the default port appropriate for the protocol for the purpose of resource discovery. The resource representation MUST be in the CoRE Link Format.
Each relation-type target attribute value MUST be treated as a separate target attribute when matching query filters, since relation-type target attributes can contain multiple space-separated values.
For the 'hosts' relation type, the target URI MUST be a relative URI of the context URI.
Implementations MUST be prepared to accept large values for the 'sz' attribute, as there is no defined upper limit. One strategy is to convert any value larger than a reasonable size limit to a special 'Big' value.
Implementations not supporting filtering MUST simply ignore the query string and return the whole resource for unicast requests. A multicast request with a query string SHOULD NOT be responded to if filtering is not supported or the filter does not match.
The link parameter 'href' is reserved for use as a query parameter for filtering and MUST NOT be defined as a link parameter.
When the values of CoRE link attributes are compared, they MUST be compared as strings. URIs used as attribute values MAY be dereferenced, but MUST NOT be dereferenced automatically on link evaluation.
Query filtering on '/.well-known/core' follows the URI Template '/.well-known/core{?search*}'. The search variable is a name/value pair where value is either a Complete Value String (exact match) or a Prefix Value String ending in '*' (prefix match).
The context URI of a link is determined by: (a) the anchor parameter when specified, (b) the origin of the target URI when specified, or (c) the origin of the link format resource's base URI.
The CoRE Link Format is a serialization of typed links based on the HTTP Link Header field serialization defined in RFC 5988, carried as a resource representation with the media type 'application/link-format' and encoded as UTF-8. Multiple link descriptions are separated by commas.
The Interface Description 'if' attribute is an opaque string providing a name or URI indicating a specific interface definition used to interact with the target resource. Multiple Interface Descriptions MAY be included separated by spaces. The 'if' attribute MUST NOT appear more than once in a link.
The maximum size estimate 'sz' attribute gives an indication of the maximum size in bytes of the resource representation returned by GET on the target URI. SHOULD be included for resources larger than one MTU. The 'sz' attribute MUST NOT appear more than once in a link.
The Resource Type 'rt' attribute is an opaque string used to assign an application-specific semantic type to a resource. Multiple Resource Types MAY be included separated by spaces. The 'rt' attribute MUST NOT appear more than once in a link.
The well-known resource '/.well-known/core' is the default entry point for CoRE Resource Discovery. In the absence of any links, a zero-length payload is returned. The resource content is organized at the application's discretion.
This specification establishes the Constrained RESTful Environments (CoRE) Parameters registry with two sub-registries: Resource Type (rt=) Link Target Attribute values and Interface Description (if=) Link Target Attribute values. Values starting with 'core' require IETF Review; all others require Specification Required with designated expert review.
This specification registers the 'application/link-format' Internet media type for the CoRE Link Format. Encoding is UTF-8 binary data; file extension is *.wlnk.
This specification registers the 'core' well-known URI in the IANA Well-Known URIs registry as defined by RFC 5785, with URI suffix 'core' and change controller IETF.
This specification registers the 'hosts' Web Linking relation type per RFC 5988. The 'hosts' relation indicates that the target URI is a resource hosted by the server indicated by the link context, and is the default relation type in CoRE Link Format.
CoRE Link Format parsers should be aware that a link description may be cyclical (contain a link to itself, directly or indirectly through referenced link resources). Care should be taken when parsing link descriptions and accessing cyclical links.
Multicast requests for well-known link-format resources could be used to perform denial of service on a constrained network. A multicast request SHOULD only be accepted if the request is sufficiently authenticated and secured using, e.g., IPsec or an appropriate object security mechanism.
The '/.well-known/core' resource MAY be protected using DTLS when hosted on a CoAP server. Servers with authentication and authorization features SHOULD support the authentication features of underlying transport protocols and MAY return different link lists based on client identity. Not providing a link does not by itself control access to the resource.
The ABNF grammar defines link-value as '<' URI-Reference '>' followed by zero or more semicolon-separated link-param entries. Link parameters include rel, anchor, rev, hreflang, media, title, title*, type, rt, if, sz, and link-extension fields.