How should I handle HATEOAS links and references in JSON? [closed]

I restarted this topic on the API-Craft google group and got some great responses.

The main advantages of the Array design are:

  • multiple links for the same relationship
  • multiple relationships for the same link without writing the link aggain
  • the ability to order the links

The map of cause has better accessibility.

As far as structure goes there are a lot of possibilities:

  • JSON-HAL: http://blog.stateless.co/post/13296666138/json-linking-with-hal or also http://stateless.co/hal_specification.html
  • JSON-LD: http://json-ld.org/ (optionally using Hydra vocabulary)
  • JSON-Schema: http://json-schema.org/ (theHyper Meta-Schema on the bottom of the page)
  • Collection+JSON: http://amundsen.com/media-types/collection/

I guess i will go with HAL as it is the cleanest solution, the rest all look kind of… strange for json.

Leave a Comment