Closed
Description
My experiments with the Hal support gave me this for a Resource having an attached Resources object. The Resource is Thorin, his belongings are the embedded Resources. I added a describedBy rel to each Resource and to Resources just for demonstration purposes.
{
"firstname": "Thorin",
"lastname": "Oakenshield1",
"products": {
"content": [
{
"productName": "Orcrist",
"_links": {
"self": {
"rel": "self",
"href": "http://localhost:8080/products/1"
},
"describedBy": {
"rel": "describedBy",
"href": "http://example.com/doc#product"
}
}
}
],
"_links": {
"describedBy": {
"rel": "describedBy",
"href": "http://example.com/doc#products"
}
}
},
"_links": {
"self": {
"rel": "self",
"href": "http://localhost:8080/people/1"
},
"describedBy": {
"rel": "describedBy",
"href": "http://example.com/doc#customer"
}
}
}
This is not the correct HAL representation of a resource with embedded resources. The correct representation should be:
{
"firstname": "Thorin",
"lastname": "Oakenshield1",
"_embedded": {
"products": [
{
"productName": "Orcrist",
"_links": {
"self": { "href": "http://localhost:8080/products/1"},
"describedBy": {"href": "http://example.com/doc#product"}
}
}
],
"_links": {
"describedBy": {"href": "http://example.com/doc#products"}
}
},
"_links": {
"self": {"href": "http://localhost:8080/people/1"},
"describedBy": {"href": "http://example.com/doc#customer"}
}
}
For decent HAL support we would also need templated URIs, for something like:
"find": { "href": "/orders{?id}", "templated": true }
Metadata
Metadata
Assignees
Labels
No labels