Skip to content

Instantly share code, notes, and snippets.

@DracoBlue
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DracoBlue/a79a1c10cf5188a03351 to your computer and use it in GitHub Desktop.
Save DracoBlue/a79a1c10cf5188a03351 to your computer and use it in GitHub Desktop.
Selecting a teacher for kids HAL example
{
"_links" : {
"self" : {"href" : "/kids/123"},
"teacher" : {"href" : "/teachers/999"},
"possible-teacher": {"href" : "/kids/123/possible-teachers"}
},
"name" : "Johnny",
"mom_phone" : "5554443333"
}
{
"_links" : {
"self" : {"href" : "/kids/123/possible-teachers"}
},
"_embedded": {
"possible-teacher": [
{
"id": 999,
"name": "Marta",
"_links": {
"choose-teacher": {"href": "/kids/123/teacher"},
"teacher": {"href" : "/teachers/999"}
}
},
"/* ... other teachers ... */"
]
}
}
{
  "_links" : {
    "self" : {"href" : "/kids/123"},
    "teacher" : {"href" : "/teachers/999"}
  },
  "name" : "Johnny",
  "mom_phone" : "5554443333"
}
// PATCH /kids/123 HTTP/1.1
// Host: example.org
[
  { "op": "replace", "path": "/_links/teacher/href", "value": "/teachers/888" },
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment