5. Web Linking
This chapter shows when and how to use links in representations, and covers details of links in the body of representations, link headers, URI templates and ap- plications of links.
- How to Use Links in XML Representations
- How to Use Links in JSON Representations
- When and How to Use Link Headers
- How to Assign Link Relation Types
- How to Use Links to Manage Application Flow
- How to Deal With Ephemeral URIs
- When and How to Use URI Templates
- How to Use Links in Clients

{ 3 comments… read them below or add one }
In the section ‘How to Use Links in JSON Representations’ you suggest the following format:
{
“links” : [
{
"rel" : "alternate",
"href" : "http://east-nj1.photos.example.org/987/nj1-1234"
},
{
"rel" : "http://www.example.org/rels/owner",
"href" : "http://east-nj1.photos.example.org/987",
}
]
}
But doesn’t it make more sense to use the ‘rel’ attribute as a key instead?
In that case it will become:
{
“links” : {
“alternate”: {
“href” : “http://east-nj1.photos.example.org/987/nj1-1234″
},
“http://www.example.org/rels/owner”:
“href” : “http://east-nj1.photos.example.org/987″,
}
}
}
Also see: http://www.scribd.com/doc/34404374/DevFest-Kuala-Lumpur-The-Google-Buzz-API-And-You
(search for the keyword ‘image_thumb’)
Thanks for you great book.
Cheers,
Erik.
Erik, that’s certainly an option, as I point out on page 91 towards the end of Recipe 5.2.
Hmmm, apparently leading spaces are not support in the comments, sorry for the messy result.