- Author
-
Mike Amundsen, [email protected]
- Status
-
Working Draft
- Last Updated
-
2024-12-20
- Proposed IANA Registrations
-
application/vnd.amundsen-uber+xml
,application/vnd.amundsen-uber+json
- Supported H-Factors
-
LO, LE, LT, LI, LN, CR, CU, CM, CL
The UBER message format is a minimal read/write hypermedia type designed to support simple state transfers and ad-hoc hypermedia-based transitions. This document describes both the XML and JSON variants of the format and provides guidelines for supporting UBER messages over the HTTP protocol.
The UBER message model has a number of design goals:
The UBER message model is designed to be a message format and not a source code format. It is optimized for cross-format use (XML and JSON) and not optimized to be directly serialized into source code or data objects. This is especially noticeable in the JSON variant of UBER. However, the UBER message model is designed to make it relatively easy to write a parser that can consistently transform UBER messages into object models (and back again).
An implementation is not compliant if it fails to satisfy one or more of the MUST or REQUIRED elements. An implementation that satisfies all the MUST and REQUIRED elements as well as all the SHOULD and RECOMMENDED elements is said to be "unconditionally compliant"; one that satisfies all the MUST and REQUIRED elements but not all the SHOULD and RECOMMENDED elements is said to be "conditionally compliant."
Note
|
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. |
The UBER message model is very minimal. There are three elements, eleven possible properties, and seven reserved string values.
There are only three elements in the UBER message model:
<uber>
-
The root element of all UBER messages
<data>
-
The main element in UBER messages.
<error>
-
The element that carries error details from the previous request.
There are eleven properties in the UBER design:
id
-
The document-wide unique identifier for this element.
name
-
A document-wide non-unique identifer for this element.
rel
-
Contains one or more link relation values.
url
-
A resolvable URL associated with this element.
action
-
The network request verb associated with this element.
transclude
-
Indicates whether the content that is returned from the URL should be embedded within the currently loaded document
model
-
Contains a template to be used to construct URL query strings or request bodies depending on the value in the
action
property. sending
-
Contains one or more media type identifiers for use when sending request bodies.
accepting
-
Contains one or more media type identifiers to expect when receiving request bodies.
value
-
In the XML variant of the UBER mesage format, inner text of the
<data>
element contains the value associated with that element. In the JSON variant there is avalue
property that contains the associated value. version
-
Indicates the UBER message version information.
There are seven reserved strings used as possible values for UBER properties.
- Reserved strings for the
action
property -
-
append
: An unsafe, non-idempotent request to add a new item. -
partial
: An unsafe, non-idempotent request to modify parts of an existing item. -
read
: A safe, idempotent request. -
remove
: An unsafe, idempotent request to delete an existing item. -
replace
: An unsafe, idempotent request to replace an existing item.
-
- Reserved strings for the
transclude
property -
-
true
: embed the results of the request into the current document -
false
: treat the associatedurl
value as a navigation to a new document.
-
There are no UBER-specific link relation values. Document authors SHOULD use registered link relation values that comply the guidance provided in RFC5988 [RFC5988] and from shared public sources such as:
-
IANA Link Relations [IANA-REL]
-
Microformats Existing Rel Values [MF-REL]
-
Dublin Core Metadata Element Set, Version 1.1 [DC-REL]
Below is a simple ‘map’ of the UBER message format (XML variant). Along with the three elements, there are ten properties (indicated by the ‘@’ character). The <data>
element can appear as a child element of <uber>
and <error>
and may be nested as many times as needed.
link:includes/message-model.xml[role=include]
This is the root element of an UBER message. Every UBER message MUST have this as its root. The <uber>
element has one optional property: version
which carries the UBER message version information. For this release, all UBER messages SHOULD be set to the value of "1.0". If the version
property is missing, it SHOULD be assumed to be set to "1.0".
<uber>
Elements<!-- XML format --> <uber version="1.0"> ... </uber> // JSON format {"uber" : {"version" : "1.0", ...} }
The <data>
element is the key element in the model. A valid UBER message SHOULD contain at least one <data>
element. If it does appear, the <data>
element appears as a child of the <uber>
or <error>
elements. The <data>
element MAY be nested as many times as needed. The <data>
element has the following property (all properties are OPTIONAL):
id
-
The document-wide unique identifier for this element. The value of
id
must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). If theid
property is present, it SHOULD be treated as an in-document reference as described in section 3.5 of RFC3986 [RFC3986]. name
-
A document-wide non-unique identifer for this element. The value of
name
must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). If thename
property is present it MAY be used as a variable in the UBERmodel
property as described in [RFC6570]. rel
-
Contains a list of link relation values. These values SHOULD conform to the guidance provided in RFC5988 [RFC5988]. In the XML variant the list of link relation values appears as a space-separated list. In the JSON variant the list of link realtion values appears as an array.
url
-
A resolvable URL associated with this element. The value SHOULD conform to that described in RFC3986 [RFC3986].
action
-
The network request verb associated with this element. The list of valid values for this element are:
-
append
: An unsafe, non-idempotent request to add a new item (e.g.HTTP.POST
[RFC2616]) -
partial
: An unsafe, non-idempotent request to modify parts of an existing item (e.g.HTTP.PATCH
[RFC5789]) -
read
: A safe, idempotent request (e.g.HTTP.GET
[RFC2616]) -
remove
: An unsafe, idempotent request to delete an existing item (e.g.HTTP.DELETE
[RFC2616]) -
replace
: An unsafe, idempotent request to replace an existing item (e.g.HTTP.PUT
[RFC2616])
When the
<data>
element has aurl
property but noaction
property, it SHOULD be assumed theaction
property is set toread
. Any value other than those listed here SHOULD be treated asread
. -
transclude
-
Indicates whether the content that is returned from the URL should be embedded within the currently loaded document (
transclude="true"
) or treated as a navigation to a new document (transclude="false"
). If the property is missing, it SHOULD be assumed to be set tofalse
(e.g. navigation). model
-
Contains a RFC6570-compliant [RFC6570] string to be used to construct URL query strings or request bodies depending on the value in the
action
property. Variables in UBERmodel
strings SHOULD be resolved using the values fromname
properties, but MAY come from any source available to the client application. If theaction
property is set toread
orremove
then themodel
is applied to the query string. If theaction
value is set toappend
,partial
, orreplace
then themodel
is applied to the request body. sending
-
Contains one or more media type identifiers for use when sending request bodies. One of the supplied identifiers SHOULD be selected as a guide when formatting the request body. For HTTP implementations, the selected identifier SHOULD be used as the value for the
Content-Type
header. If this property is missing the setting should be assumed to beapplication/x-www-form-urlencoded
as described in RFC1867 [RFC1867].In the XML variant the list of media-type identifiers appears as a space-separated list. In the JSON variant the list of media-type identifiers appears as an array.
accepting
-
Contains one or more media type identifiers to expect when recieving request bodies. The contents of this property SHOULD indicate the formats in which the server is able to return a response body. For HTTP implementations the contents of this property SHOULD be used as the value for the
Accept
header. If this property is missing, the setting should be assumed to be set to the same value as that of the currently loaded representation (application/vnd.uber-amundsen+xml
orapplication/vnd.uber-amundsen+json
).In the XML variant the list of media-type identifiers appears as a space-separated list. In the JSON variant the list of media-type identifiers appears as an array.
value
-
In the XML variant of the UBER mesage format, inner text of the
<data>
element contains the value associated with that element.In the JSON variant there is a
value
property that contains the associated value. Note that the content of this field MUST NOT be a JSON object or array and MUST be one of the following scalar values (listed in Section 2.1 of RFC4627 [RFC4627]):-
number
-
string
-
false
-
true
-
null
-
<data>
Elements (XML)link:includes/search-sample.xml[role=include]
<data>
Elements (JSON)link:includes/search-sample.js[role=include]
The <error>
element contains any error information returned by the server regarding the previous request. The <error>
element has no properties. This is an OPTIONAL element. When present, it SHOULD contain one or more <data>
child elements. It is the <data>
child elements that contains error details.
<error>
Element (XML)link:includes/error-sample.xml[role=include]
<error>
Element (JSON)link:includes/error-sample.js[role=include]
Since the UBER messsage format was designed to work with multiple application protocols (HTTP, CoAP, etc.), there needs to be some guidelines for creating a protocol-specific implementation that supports UBER documents. Below is the HTTP guidance for UBER documents. This can be used as a guide in creating (and documenting) other protocol-specific implemenations.
This section decribes the details of implementing UBER support over HTTP.
When implementating support for UBER documents over HTTP one of the key details is to map the value of UBER’s action
property to HTTP methods. Table #1 below provides this mapping:
action
and model
Values
UBER Action | HTTP Method | UBER Model Modifies |
---|---|---|
|
POST |
Request Body |
|
PATCH |
Request Body |
|
GET |
Query String |
|
DELETE |
Query String |
|
PUT |
Request Body |
When applied to HTTP, any model
value associated with a data
element with the action
property set to read
or remove
MUST be converted into a valid query string. The follwing example shows how an UBER message snippet is converted into a valid HTTP query string:
read
Action into an HTTP Query Stringlink:includes/uber-query-string.txt[role=include]
Any model
value associated with a data
element with the action
property set to append
, partial
, or replace
MUST be convereted into a valid HTTP request body. The follwing example shows how an UBER message snippet is converted into a valid HTTP request body:
append
Action into an HTTP Requestlink:includes/uber-request-body.txt[role=include]
It is possible that UBER documents can be exchanged using a protocol other than HTTP. In that case, it is the responsibility of the implementor to provide a guideline document that covers the same material included in the "Implementation Guidelines" of the UBER Message specification.
UBER messages may appear in XML or JSON formats. Below are examples of each.
Below is an XML Example of an UBER message.
link:includes/full-example.xml[role=include]
This document describes the UBER message format markup vocabulary. Markup from other vocabularies ("foreign markup") can be used in an UBER document. Any extensions to the UBER Hypermedia vocabulary MUST not redefine any objects (or their properties), arrays, properties, link relations, or data types defined in this document. Clients that do not recognize extensions to the UBER vocabulary SHOULD ignore them.
The details of designing and implementing UBER extensions is beyond the scope of this document.
Note
|
It is possible that future forward-compatible modifications to this specification will include new objects, arrays, properties, link-relations, and data types. Extension designers should take care to prevent future modifications from breaking or redefining those extensions. |
Below are the related IANA considerations for this media type design.
The XML variant of the UBER message format shares security issues common to all XML content types. It does not provide executable content. Information contained in UBER documents do not require privacy or integrity services.
The JSON variant of the UBER message format shares security issues common to all JSON content types. See RFC4627 Section #6 [RFC4627] for additional information. The UBER message format does not provide executable content. Information contained in UBER documents do not require privacy or integrity services.
Below are the references used in this document.
-
[RFC1867] Nebel, E., Masinter, L., "Form-based File Upload in HTML", November 1995, http://tools.ietf.org/search/rfc1867
-
[RFC2119] Bradner, S.,"Key words for use in RFCs to Indicate Requirement Levels", March 1997, http://tools.ietf.org/html/rfc2119
-
[RFC2616] Fielding, R, et al, "Hypertext Transfer Protocol — HTTP/1.1", June 1999, https://tools.ietf.org/html/rfc2616
-
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter,"Uniform Resource Identifier (URI): Generic Syntax", January 2005, http://tools.ietf.org/html/rfc3986
-
[RFC4627] D. Crockford, "The application/json Media Type for JavaScript Object Notation (JSON)", July 2006, http://tools.ietf.org/html/rfc4627
-
[RFC5789] Dusseault, L., Snell, J., "PATCH Method for HTTP", March 2010, https://tools.ietf.org/html/rfc5789
-
[RFC5988] Nottingham, M., "Web Linking", October 2010, http://tools.ietf.org/html/rfc5988
-
[RFC6570] Gregorio, J., Fielding, R., Hadley, M., Nottingham, M., Orchard, D., "URI Template", March 2012, http://tools.ietf.org/html/rfc6570
-
[REC-XML] Bray, T., Paoli, J., Sperberg-McQueen, C., Maler, E., Yergeau, F., "Extensible Markup Language (XML) 1.0 (Fifth Edition)", November 2008, http://www.w3.org/TR/REC-xml/
-
[HFactor] Amundsen, M. "H Factor", May 2010, http://amundsen.com/hypermedia/hfactor/
-
[IANA-REL] "Link Relations, December 2013, http://www.iana.org/assignments/link-relations/link-relations.xhtml
-
[MF-REL] "Microformat Existing Rel Values", February 2014, http://microformats.org/wiki/existing-rel-values
-
[DC-REL] "Dublin Core Metadata Element Set, Version 1.1", June 2012, http://dublincore.org/documents/dces/
-
[CoAP] "Shelby, Z., Hartke, K., Bormann, C., "Constrained Application Protocol (CoAP)", June 28, 2013, https://tools.ietf.org/html/draft-ietf-core-coap-18