REST Principles II: Representations and Hyperlinking

Principles and Patterns of Organizing Systems [./]
Spring 2011 — INFO 290-6 (CCN 42628)

Erik Wilde and Robert J. Glushko, UC Berkeley School of Information
2011-03-15

Creative Commons License [http://creativecommons.org/licenses/by/3.0/]

This work is licensed under a CC
Attribution 3.0 Unported License
[http://creativecommons.org/licenses/by/3.0/]

Contents E. Wilde: REST Principles II: Representations and Hyperlinking

Contents

E. Wilde: REST Principles II: Representations and Hyperlinking

(2) Abstract

Identification, identity and the uniform interface (how to interact with identified things) are the most basic constraints of REST. Today, we look at two more constraints of the REST architectural style: Representations are the only thing that are actually available in a RESTful system, and when interacting with a resource, the interactions use self-describing representation. This means that it is possible for actors in a RESTful system to interact with resources without prior knowledge of what media types to expect or to use. We will look at different metamodels that can be used to define specific representations, HTML, XML, JSON, and RDF are popular examples. Since interactions yield representations that are supposed to be starting points for further interactions, representing links is another core constraint of REST. Links often have (implicit or explicit) types which guide clients of RESTful services through the set of available resources. We will look at links from the RESTful perspective, looking at popular patterns such as directories, search services, and typical purchasing workflows.



Structure and Representation

Outline (Structure and Representation)

  1. Structure and Representation [3]
  2. Representation and Linking [4]
  3. Linking and Interaction [3]
Structure and Representation E. Wilde: REST Principles II: Representations and Hyperlinking

(4) Resources and Resource Links



Structure and Representation E. Wilde: REST Principles II: Representations and Hyperlinking

(5) Representation Structure and Link Structure



Structure and Representation E. Wilde: REST Principles II: Representations and Hyperlinking

(6) Separating Resources is Essential

  1. Identify resources (hard problem: decide on granularity)
  2. Identify resource linkages
  3. Decide whether linkages are inherent or external
  4. Analyze the best natural fit in terms of the metamodel
  5. Design data models including the inherent links
  6. Build inventory of external links
  7. Model external links as separate resources


Representation and Linking

Outline (Representation and Linking)

  1. Structure and Representation [3]
  2. Representation and Linking [4]
  3. Linking and Interaction [3]
Representation and Linking E. Wilde: REST Principles II: Representations and Hyperlinking

(8) Links as Resources



Representation and Linking E. Wilde: REST Principles II: Representations and Hyperlinking

(9) Link Overlay Example

Snap.com and Google Preview showing "competing" thumbnails

Representation and Linking E. Wilde: REST Principles II: Representations and Hyperlinking

(10) Zoos as Link Overlays



Representation and Linking E. Wilde: REST Principles II: Representations and Hyperlinking

(11) Food Courts as Link Overlays



Linking and Interaction

Outline (Linking and Interaction)

  1. Structure and Representation [3]
  2. Representation and Linking [4]
  3. Linking and Interaction [3]
Linking and Interaction E. Wilde: REST Principles II: Representations and Hyperlinking

(13) Inherent and External Links



Linking and Interaction E. Wilde: REST Principles II: Representations and Hyperlinking

(14) Linkbases as Link Overlays



Linking and Interaction E. Wilde: REST Principles II: Representations and Hyperlinking

(15) Sidewiki Web Element

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>An exciting Sidewiki Test!</title>
  <!-- Load Sidewiki element Javascript API -->
  <script src="http://www.google.com/sidewiki/static/sidebar_element/sidebar-element-compiled.js"></script>
 </head>
 <body>
  <!-- Initialize element -->
  <script>
   // Create the element, show entries for the current webpage.
   var sidebarElement = new google.elements.sidewiki.SidebarElement(window.location.href, true);
  </script>
  <h1>An exciting Sidewiki Test!</h1>
  <p>Here's some fascinating content!</p>
 </body>
</html>


2011-03-15 Principles and Patterns of Organizing Systems [./]
Spring 2011 — INFO 290-6 (CCN 42628)