Jay Taylor's notes

back to listing index

The Hypertext Application Language

[web search]
Original source (stateless.co)
Tags: web-architecture json api hal hypertext rest stateless.co
Clipped on: 2017-06-23

The example below is how you might represent a collection of orders with hal+json. Things to look for:

  • The URI of the main resource being represented ('/orders') expressed with a self link
  • The 'next' link pointing to the next page of orders
  • A templated link called 'ea:find' for searching orders by id
  • The multiple 'ea:admin' link objects contained in an array
  • Two properties of the orders collection; 'currentlyProcessing' and 'shippedToday'
  • Embedded order resources with their own links and properties
  • The compact URI (curie) named 'ea' for expanding the name of the links to their documentation