Hypermedia and H Factors

inadarei edited this page Apr 9, 2013 · 5 revisions

NOTE: Following information is abridged from a seminal book about Hypermedia APIs: Mike Amundsen, Building Hypermedia APIs with HTML5 and Node. It is presented here as a reference, but to get a more complete understanding of H-Factors and Hypermedia (and to support the author) you should absolutely consider buying the book.

This is how Mr. Amundsen describes H-Factors and their role in Hypermedia:

Designing hypermedia messages involves deciding how to represent the requested data (including metadata about the requested data) as well as deciding how to represent application metadata such as possible filters, searches, and options for sending data to the server for processing and storage.

The details of representing the application metadata is handled by hypermedia elements within the message. The actual message elements, attributes, etc. used to represent these options vary depending on the base format and the registered media type in use. However, despite these variances, the abstract options represented are the same across all media types and format. These are referred to in this book as “Hypermedia Factors” or “H-Factors.”

H-Factors: Links

H-Factor Name Example
LO Outbound Links <a href=""> in HTML
LT Templated Links HTML's Form element (method=GET) which generates parametrized HTTP GET URL
LI Idempotent Links HTTP PUT and HTTP DELETE requests
LN Non-Idempotent Links HTML's Form element (method=POST)

H-Factors: Control Data

H-Factor Name Example
CR Read Controls HTTP Headers, such as: Accept- Language
CU Update Controls "enctype" in: <form method="post" action="..." enctype="text/plain">
CM Method Controls "method" in: <form method="post" action="...">
CL Link Annotation Controls CL factors provide a way for servers to “decorate” links with additional metadata using an agreed-upon set of keywords. Good example is "rel" attribute in <link rel="stylesheet" href="..." />