hyperfriendly+json is a simple and extensible hypermedia format. It adds links to JSON objects.
This resource has a single property hello and a single self link.
{ "_links": { "self": { "href": "http://api.example.org/hello" } }, "hello": "hyperfriendly+json" }
If you want, you can add several links to the same rel. Here is a resource that links to multiple authors.
{ "_links": { "author": [ { "href": "http://api.example.org/oyvind" }, { "href": "http://api.example.org/nils" } ] } }
Links can contain link profiles that add semantics to the link. This link implements the templated link profile.
{ "_links" : { "linkProfiles": [ "http://profiles.hyperfriendly.net/templated-link" ] "usersbyname": { "href": "/users{?name}" } } }
Resources implement resource profiles by adding a rel with the name "profile" with a link to one or more profiles. The following is an error resource.
{ "_links" : { "profile": "http://profiles.hyperfriendly.net/error" }, "_errors": [ { "_links": { "self": { "href": "http://api.example.org/some-error" } }, "title": "Some error", "message": "Some error has occurred" } ] }