-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Non-HAL) JSON output #68
Comments
Hi, the upcoming 1.1 release does actually have this feature! It was a feedback we already had and you confirm this need. There is a new query parameter called hal that can be f (full) or c (compact); the default value (if you omit it) is compact. On compact mode, the curies, templated links, pagination links (for root, db and collection resources) are not included in the response. However this has nothing to do with HAL. The representation is still HAL (that is json anyway), where resources have properties, links and embedded resources. So root embeds dbs that embed collections that embed documents; links allow to navigate the API that we think is a big plus. I don't get the point about the "Compatibility with most web frameworks out of the box". hal+json media type is json anyway so there shouldn't be any problem; can you elaborate on this? An example is: Compact HAL mode
I think I'll remove the _lastupdated_on and _type properties as well in compact mode (those are not really properties stored in the db, but injected by RESTHeart). You'll notice the empty array curies between the _links. We wanted to remove it but we kept it due a bug in the HAL browser (mikekelly/hal-browser#71). Full HAL mode
|
just committed a change, in hal compact mode, the special properties (_type, _lastupdated_on and _created_on) are not returned anymore. |
@ujibang Sweet! Thank you guys! PS: As for the compatibility issues, the problem is not parsing the JSON but the need for the JSON to be navigated by app logic to get to the expected meat of the data: |
I see your point. We choose HAL because a collection (which embeds documents) must be navigated anyway and we preferred to relay on an established representation standard format... we need this embedding approach because in RESTHeart dbs, and collections can have their own properties too. Some special properties are metadata and can modify the responses. See for instance how the document references are managed here or the request checkers here |
@sgnn7 for your information release 1.1 is out with compact HAL format. |
@ujibang Awesome! Thanks for pinging me on this! |
I've tried to use this software with at least 8 clients from the environment of the gaming, corporative, etc. HAL mode is a shame and totally uncompatible with modern interfaces. |
Hi @DaBlitzStein, we agree with you and actually introduced the plain json representation format long ago. HAL is still available via configuration:
documents of a collection are still in the You can get the documents of a collection as an array just passing the
To get the properties of the collections (such as
Are you happy with this? We are open to suggestions... |
@ujibang I think this aspect should be better documented by us, the plain JSON representation with no properties it's an important feature but probably not enough highlighted. |
While I understand the reasons for having the HAL+JSON output, it feels like there could be numerous advantages to also having pure JSON that would support modular/generic API interfaces.
For example, a generic API call to something like
http GET 127.0.0.1:8080/myfirstdb/myfirstcoll
should really return something more like the regular JSON in most web programming frameworks:instead of the
_embedded
,rh:doc
, and all the other_*
tags that HAL injects; yes some of this can be filtered but it would be nice to have a simpleHAL_JSON = true/false
flag that switches between these two.tl;dr
Primary reasons for ability to also use non-HAL JSON:
The text was updated successfully, but these errors were encountered: