The upcoming RESTHeart 3.0 release is going to bring a new, exiting feature: plain JSON representation of resources besides the usual HAL format. This dramatically simplifies handling with the API and answers some feedbacks we got from the community; as usual, you asked, we listened!
RESTHeart has been using the popular Hypertext Application Language since its inception.
The reason behind this choice is simple: HAL is elegant and fits perfecly in the nested nature of resources such as dbs, collection and documents.
On the other hand HAL is indeed verbose! As example a collection resource is represented in the response as follows:
You can note that the collection is represented with its properties (_id , _etag, etc) and its nested resources, i.e. the documents! Those are in the array rh:doc in the object _embedded .
Other resources (dbs, file buckets, etc) are represented in a similar way.
SoftInstigate developed an angular.js module to make simple to interact with such representation format (and the authentication). Check it at angular-restheart github repo.
With the 3.0 release you will be able to pass the pj query parameter (where pj stands for Plain Json). It switches the representation to a simplified form where:
- GET / returns an array of datases objects
- GET /db returns an array of collections objects
- GET /db/coll returns an array of documents objects
You can download the 3.0-SNAPSHOT from sonatype
With pj the response looks like:
How cool is that?