It probably doesn't make sense to nest reviews within an album
representation, but may do with the album within a band e.g:
GET /band/231876
200 OK
{
_links: { self: { href: "/band/231876" } },
name: "Stars of the Lid",
_embedded: {
albums: [{
links: {
self: { href: "/album/123876123" },
reviews: { href: "/album/123876123/reviews" }
},
name: "Music for Nitrous Oxide",
year: "1995"
},{
links: {
self: { href: "/album/98798799" },
reviews: { href: "/album/98798799/reviews" }
},
name: "The Ballasted Orchestra",
year: "1997"
}]
}
}
> 1. This format can be used to browse a collection of bands with their
> albums. Meaning, the hyper-links must be understood by the user who is
> browsing the data. I will check about how the link processing can be done (I
> think rendering as <a href="..."> in a common HTML client, but also as
> data-json attribute in a <ul> for example ? )
I'm not sure what you are asking here. This particular use of HAL
means that the representation on its own can be used to 'browse' a
band and their albums, it could also be used to represent a link to a
resource that shows you the reviews for a given album..
Oh ok, well I hacked up the hal browser[1] as a generic tool for
browsing any API that is using the HAL media type.. maybe that will
give you some inspiration?
I'm not aware of any generic tooling, but do you need it? in hal
browser I simply passed the _links object into a template and
generated the html through that.
[1] https://github.com/mikekelly/hal-browser
Cheers,
M
Yes, exactly.
Thanks :)
Cheers,
M