Skip to content

Instantly share code, notes, and snippets.

@mamund
Created August 25, 2014 15:44
Show Gist options
  • Save mamund/7d95283027ef30797b49 to your computer and use it in GitHub Desktop.
Save mamund/7d95283027ef30797b49 to your computer and use it in GitHub Desktop.
cross-compatible "embed" for Cj. clients that support the "embedded" extension can ignore the links that are marked "render" : "embedded"
{
"collection": {
"href": "/characters.json",
"links" : [
{"rel" : "collection", "href" : "/characters/the_doctor/actors.json", "render" : "embedded"}
],
"embedded": [
{
"collection": {
"href": "/characters/the_doctor/actors.json",
"items": [
{
"href": "/doctors/1.json",
"data": [
{
"name": "full-name",
"value": "William Hartnell"
}
]
},
{
"href": "/doctors/2.json",
"data": [
{
"name": "full-name",
"value": "Patrick Troughton"
}
]
},
{
"href": "/doctors/3.json",
"data": [
{
"name": "full-name",
"value": "Jon Pertwee"
}
]
},
{
"href": "/doctors/4.json",
"data": [
{
"name": "full-name",
"value": "Tom Baker"
}
]
}
]
}
}
],
"items": [
{
"href": "/characters/the_doctor.json",
"links": [
{
"href": "/characters/the_doctor/actors.json",
"rel": "actors",
"render": "link",
"prompt": "Actors"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment