Re: Internet-Draft: JSON Hypertext Application Language
François Verry <[email protected]>
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Message-ID | <[email protected]> |
>> I'd remove
>> the "self" link since it is redundant. The resource consumer already
>> knows the resource URIs.
>
> That may be true for the root resource, but not for the embedded
> resources. I think it's 'tidier' to include it for all resource
> objects as it is consistent and lends itself better to situations
> where resources are included as partials within other documents.
>
Hi, and thanks for that RFC.
At http://stateless.co/hal_specification.html it is mentionned that
"Content embedded within a Resource element MAY be a full, partial,
summary, or incorrect representation of the content available at the
target URI ..."
When discovering HAL I found this line very useful in understanding the
power of embedded resources + self link combination. Maybe the RFC
should re-use this phrase ?
A second thought, but it may be out of line : since
* all sub-resources are embedded via a rel value
* have a self link
* can have a partial content
what goal does the "_links" special attribute serves ? couldn't links be
considered as "empty embedded resources" ?
For example, the following :
{
"_links": {
"self": { "href": "/orders" },
"next": { "href": "/orders?page=2" },
},
"_embedded": {
"order": { ... }
}
}
Could as weel be translated into :
{
"_self": { "href": "/orders" },
"_embedded": {
"next": {
"_self" : { "href": "/orders?page=2" },
},
"order": {
...
}
}
}
It seems to me that replacing "_links": { "self" : {} } by a simple
"_self" : {} doesn't impair the possibility to reference the page 2
under a "next" rel.
Thanks for your precisions
François