Closed francisco-andrade closed 8 years ago
Hi @chicoandrade ,
RESTHeart 1.x is indeed verbose.
We addressed this on 2.0 (still in beta-1) where you would get:
{ "_embedded" :
{ "rh:doc" : [ { "_id" : { "$oid" : "56c322703b868aca994001fe" },
"name" : "solr",
"version" : "4.10"
} ] },
"_returned" : 1
}
this also specifying the np
query parameter that excludes collection properties (such as its _etag) from the response. in any case the default hal mode (compact) doesn't return _links
and curies
anymore.
Hi @chicoandrade, have you tried the 2.0.0 beta release about this?
Hi @mkjsix , no, I haven't.
I was expecting to get only the rh:doc
content on the example showed here by Andrea, but I'll try it
Just tested the 2.0.0 beta and the return had a bit more data than I expected: { "_id": "services", "_created_on": "2016-02-22T19:12:36Z", "_etag": { "$oid": "56cb5da446e0fb00099065d3" }, "_returned": 1, "_embedded": {"rh:doc": [{"_id": {"$oid": "56c322703b868aca994001fe"},"name": "solr","version": "4.10"}]} }
It would be great to have an even simpler option other than hal=c
returning only the rh:doc
content that usually returns on the mongodb shell client.
{"_id": {"$oid": "56c322703b868aca994001fe"},"name": "solr","version": "4.10"}
@chicoandrade
I understand your point, however we chose HAL as representation format because it's simple, elegant and standardized.
In HAL, embedded resources goes into the _embedded property.
Hi there,
Is there any setting I can do to enable simple json returning on restheart queries?
Even with "hal=c" restheart returns a bigger json than I expected. For example: { "_links" : { "self" : { "href" : "/restheart/persistencia_hml/services?filter={\"name\":\"solr\"}&hal=c"} , "curies" : [ ]} , "_id" : "services" , "_created_on" : "2016-02-22T19:12:36Z" , "_etag" : { "$oid" : "56cb5da446e0fb00099065d3"} , "_collection-props-cached" : false , "_returned" : 1 , "_embedded" : { "rh:doc" : [ { "_links" : { "self" : { "href" : "/restheart/persistencia_hml/services/56c322703b868aca994001fe"}} , "_id" : { "$oid" : "56c322703b868aca994001fe"} , "name" : "solr" , "version" : "4.10"}]}}
I expected to get simple document json as in the mongo shell client:
Is there any setting or parameter to get this return?
Thanks Francisco Andrade