Skip to content

Instantly share code, notes, and snippets.

@mustmodify
Last active August 29, 2015 14:05
Show Gist options
  • Save mustmodify/4a88f1f588bda5d87bb1 to your computer and use it in GitHub Desktop.
Save mustmodify/4a88f1f588bda5d87bb1 to your computer and use it in GitHub Desktop.
drwho
/* from item-level link */
{
"collection": {
"href": "/characters.json",
"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"
}
]
}
]
}
}
/* from root-level link */
/* note that the link matches the URL of collection.embedded[0].collection.items[0].href, rather than
collection.embedded[0].collection.href. Is this an error state? Let's discuss. */
{
"collection": {
"href": "/doctors.json",
"embedded": [
{
"collection": {
"href": "/doctors/3.json",
"items": [
{
"href": "/doctors/3.json",
"data": [
{
"name": "full-name",
"value": "Jon Pertwee"
},
{
"name": "first-appearance",
"value": "1970-01-03"
},
{
"name": "last-appearance",
"value": "1974-06-08"
}
]
}
]
}
}
],
"links": [
{
"href": "/doctors/3.json",
"rel": "incarnation",
"render": "link",
"prompt": "Jon Pertwee"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment