Skip to content

Instantly share code, notes, and snippets.

@jblanche
Last active December 17, 2015 08:49
Show Gist options
  • Save jblanche/5582887 to your computer and use it in GitHub Desktop.
Save jblanche/5582887 to your computer and use it in GitHub Desktop.
JSON API
The question is, how do we create linked resources with the main one, e.g. if for some business reasons a user is created with an avatar and the avatar is a different resource because it can be associated with other stuff than a user...
What should be the format of the POST request on /users doing this ?
{
"users" : [
"firstname" : "John",
"lastname" : "Doe",
"avatar" : [
"url": "http://foo"
]
],
"links": {
"friends": ["1", "4", "8"]
}
}
{
"users" : [
"firstname" : "John",
"lastname" : "Doe"
],
"links": {
"friends" : ["1", "4", "8"],
"avatar" : [
"url" : "http://foo"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment