Thursday, March 06, 2014

JSON Hypertext Application Language (HAL)

draft-kelly-json-hal-06 - JSON Hypertext Application Language:

"This document proposes a media type for representing resources and
their relations with hyperlinks."




Amazon Chooses HAL Media Type for AppStream API 

Amazon has released a new API, the AppStream API, which allows you to programmatically manage applications hosted on the Amazon AppStream platform. For this API, they chose to build it with the HAL media type. HAL is a minimalistic hypermedia enabled media type for building machine-to-machine APIs.

Example: The HAL Browser

{
  "_links": {
    "self": {
      "href": "/"
    },
    "curies": [
      {
        "name": "ht",
        "href": "http://haltalk.herokuapp.com/rels/{rel}",
        "templated": true
      }
    ],
    "ht:users": {
      "href": "/users"
    },
    "ht:signup": {
      "href": "/signup"
    },
    "ht:me": {
      "href": "/users/{name}",
      "templated": true
    },
    "ht:latest-posts": {
      "href": "/posts/latest"
    }
  },
  "welcome": "Welcome to a haltalk server.",
  "hint_1": "You need an account to post stuff..",
  "hint_2": "Create one by POSTing via the ht:signup link..",
  "hint_3": "Click the orange buttons on the right to make POST requests..",
  "hint_4": "Click the green button to follow a link with a GET request..",
  "hint_5": "Click the book icon to read docs for the link relation."
}

No comments: