Skip to content

Instantly share code, notes, and snippets.

@smellymonk
Last active August 29, 2015 14:19
Show Gist options
  • Save smellymonk/a339872ad7c4422cad63 to your computer and use it in GitHub Desktop.
Save smellymonk/a339872ad7c4422cad63 to your computer and use it in GitHub Desktop.
{
"_links": {
"self": { "href": "/customers/1234" },
"collection": { "href": "/customers" }
},
"name": "Bob Jones",
"street": "123 California Ave",
"city": "Sacramento",
"state": "CA",
"zip": "12345",
"phone": "+1 (123) 456 7890",
"active": true,
"credit_limit": "48"
}
{
"_links": {
"self": { "href": "/customers" },
"item": [{
"href": "/customers/1",
"title": "Sally"
}, {
"href": "/customers/2",
"title": "Sue"
}, {
"href": "/customers/3",
"title": "Joe Biden"
}, {
"href": "/customers/1234",
"title": "Bob Jones"
}]
}
}
{
"_links": {
"self": { "href": "/customers" }
},
"_embedded": {
"item": [{
"_links": {
"self": { "href": "/customers/1" }
},
"name": "Sally",
"street": "123 California Ave",
"city": "Sacramento",
"state": "CA",
"zip": "12345",
"phone": "+1 (123) 456 7890",
"active": true,
"credit_limit": "10"
},
{
"_links": {
"self": { "href": "/customers/2" }
},
"name": "Sue",
"street": "123 California Ave",
"city": "Sacramento",
"state": "CA",
"zip": "12345",
"phone": "+1 (123) 456 7890",
"active": true,
"credit_limit": "20"
},
{
"_links": {
"self": { "href": "/customers/3" }
},
"name": "Joe Biden",
"street": "123 California Ave",
"city": "Sacramento",
"state": "CA",
"zip": "12345",
"phone": "+1 (123) 456 7890",
"active": true,
"credit_limit": "30"
},
{
"_links": {
"self": { "href": "/customers/1234" }
},
"name": "Bob Jones",
"street": "123 California Ave",
"city": "Sacramento",
"state": "CA",
"zip": "12345",
"phone": "+1 (123) 456 7890",
"active": true,
"credit_limit": "48"
}]
}
}
@smellymonk
Copy link
Author

Note that for the embedded resources case, you could have pagination. See http://phlyrestfully.readthedocs.org/en/latest/halprimer.html#collections
...and notice the "self", "prev", "next", "first", and "last" link relations which are all standard IANA link relations for pagination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment