Skip to content

Instantly share code, notes, and snippets.

@tjklemz
Last active August 29, 2015 14:19
Show Gist options
  • Save tjklemz/6b0b8aabcfe9bd43ee28 to your computer and use it in GitHub Desktop.
Save tjklemz/6b0b8aabcfe9bd43ee28 to your computer and use it in GitHub Desktop.
{
"_links": {
"self": "/contacts"
},
"_embedded": {
"contact": [{
"_links": {
"self": { "href": "/contacts/1" }
},
"name": "Bob Marley",
"telephone": "123-456-7890",
"email": "name@example.com",
"birthdate": "01/11/1990",
"address": "123 Jersey St, New York, NY 10001"
},
{
"_links": {
"self": { "href": "/contacts/2" }
},
"name": "John Smith",
"telephone": "123-456-7890",
"email": "name@example.com",
"birthdate": "02/20/1980",
"address": "123 Jersey St, New York, NY 10001"
}]
}
}
@tjklemz
Copy link
Author

tjklemz commented Apr 19, 2015

GET /contacts returns the list.
POST /contacts with a payload of a contact/person JSON (with name, telephone, etc) will create a contact.
GET /contacts/id returns the contact
POST /contacts/id updates the contact based on the contact/person JSON payload.
DELETE /contacts/id removes the specified contact.

Note that I think we might add authentication on specific deletes later. We can talk about this. E.g., trying to edit or delete /contacts/1 works fine, but /contacts/2 requires authentication. Just something to consider. It shows that the authentication is reactive (stateless).

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