Skip to content

Instantly share code, notes, and snippets.

@CharlotteGore
Last active December 26, 2015 23:29
Show Gist options
  • Save CharlotteGore/7231389 to your computer and use it in GitHub Desktop.
Save CharlotteGore/7231389 to your computer and use it in GitHub Desktop.
Hypermedia To-Do List Application API draft
/* GET:/ */
{
"_links" : {
"self" : {
"href" : "/"
},
"curie" : {
"name" : "controls"
"href" : "/rels/{rel}",
"templated" : true
},
"controls:create-user" : {
"href" : "#_controls/edit/create-user"
},
"_embedded" : {
"user" : [
{
"_links" : {
"self" : {
"href" : "/user/charlotte"
},
"todo-list" : {
"href" : "/user/charlotte/to-do-list"
}
},
"name" : "Charlotte Gore",
"TotalToDoCount" : 3,
"openToDoCount" : 2
},
{
"_links" : {
"self" : {
"href" : "/user/matt"
},
"todo-list" : {
"href" : "/user/matt/to-do-list"
}
},
"name" : "Matt Smith",
"TotalToDoCount" : 0,
"openToDoCount" : 0
}
]
},
"_controls" : {
"edit" : {
"create-user" : {
"method" : "POST",
"action" : "/create-user",
"properties" : [
{
"type" : "text",
"name" : "name",
"value" : ""
}
]
}
}
}
}
}
/* GET : /user/charlotte */
{
"_links" : {
"self" : {
"href" : "/user/charlotte"
},
"todo-list" : {
"href" : "/user/charlotte/to-do-list"
}
},
"name" : "Charlotte Gore",
"TotalToDoCount" : 3,
"openToDoCount" : 2
}
/* GET : /user/charlotte/to-do-list */
{
"_links" : {
"self" : {
"href" : "/user/charlotte/to-do-list"
},
"curie" : {
"name" : "controls",
"href" : "/to-do-list/rels/{rel}",
"templated" : true
},
"controls:add-item" : {
"href" : "#_controls/edit/add-new-to-do-item"
}
},
"count" : 2,
"activeCount" : 2,
"_embedded" : {
"todo-item" : [
{
"_links" : {
"self" : {
"href" : "/to-do-items/1"
},
"owner" : {
"href" : "/user/charlotte"
},
"curie" : {
"name" : "controls"
"href" : "/to-do-items/1/rels/{rel}",
"templated" : true
},
"controls:mark-as-complete" : {
"href" : "#_controls/edit/complete"
},
"controls:edit-item" : {
"href" : "#_controls/edit/edit"
},
"controls:delete-task" : {
"href" : "#_controls/edit/delete"
}
},
"taskDescription" : "Buy some noodles",
"complete" : false,
"created" : 1383132444731,
"owner" : "Charlotte Gore",
"_controls" : {
"edit" : {
"complete" : {
"method" : "PUT",
"action" : "/to-do-items/1/complete",
"encoding" : "x-form-www-url-encoding"
},
"edit" : {
"method" : "PUT",
"action" : "/to-do-items/1/edit-task",
"encoding" : "x-form-www-url-encoding",
"properties" : [
{
"type" : "text",
"name" : "taskDescription",
"value" : "Buy some noodles"
}
]
},
"delete" : {
"method" : "DELETE",
"action" : "/to-do-items/1/delete-task",
"encoding" : "x-form-www-url-encoding"
}
}
}
},
{
"_links" : {
"self" : {
"href" : "/to-do-items/2"
},
"owner" : {
"href" : "/user/charlotte"
},
"curie" : {
"name" : "controls"
"href" : "/to-do-items/2/rels/{rel}",
"templated" : true
},
"controls:mark-as-complete" : {
"href" : "#_controls/edit/complete"
},
"controls:edit-item" : {
"href" : "#_controls/edit/edit"
},
"controls:delete-task" : {
"href" : "#_controls/edit/delete"
}
},
"taskDescription" : "Buy more noodles",
"complete" : false,
"created" : 1383132456879,
"owner" : "Charlotte Gore",
"_controls" : {
"edit" : {
"complete" : {
"method" : "PUT",
"action" : "/to-do-items/2/complete",
"encoding" : "x-form-www-url-encoding"
},
"edit" : {
"method" : "PUT",
"action" : "/to-do-items/2/edit-task",
"encoding" : "x-form-www-url-encoding",
"properties" : [
{
"type" : "text",
"name" : "taskDescription",
"value" : "Buy some noodles"
}
]
},
"delete" : {
"method" : "DELETE",
"action" : "/to-do-items/2/delete-task",
"encoding" : "x-form-www-url-encoding"
}
}
}
},
{
"_links" : {
"self" : {
"href" : "/to-do-items/3"
},
"owner" : {
"href" : "/user/charlotte"
},
"curie" : {
"name" : "controls"
"href" : "/to-do-items/3/rels/{rel}",
"templated" : true
},
"controls:mark-as-outstanding" : {
"href" : "#_controls/edit/uncomplete"
},
"controls:edit-item" : {
"href" : "#_controls/edit/edit"
},
"controls:delete-task" : {
"href" : "#_controls/edit/delete"
}
},
"taskDescription" : "Sell noodles",
"complete" : true,
"created" : 1383132456879,
"owner" : "Charlotte Gore",
"_controls" : {
"edit" : {
"uncomplete" : {
"method" : "PUT",
"action" : "/to-do-items/3/uncomplete",
"encoding" : "x-form-www-url-encoding"
},
"edit" : {
"method" : "PUT",
"action" : "/to-do-items/3/edit-task",
"encoding" : "x-form-www-url-encoding",
"properties" : [
{
"type" : "text",
"name" : "taskDescription",
"value" : "Sell noodles"
}
]
},
"delete" : {
"method" : "DELETE",
"action" : "/to-do-items/3/delete-task",
"encoding" : "x-form-www-url-encoding"
}
}
}
}
]
},
"_controls" : {
"edit" : {
"add-new-to-do-item" : {
"method" : "POST",
"action" : "/to-do-items/1/create-new",
"encoding" : "x-form-www-url-encoding",
"properties" : [
{
"type" : "text",
"name" : "taskDescription",
"value" : ""
}
]
}
}
}
}
/* GET: /to-do-items/1 */
{
"_links" : {
"self" : {
"href" : "/to-do-items/1"
},
"owner" : {
"href" : "/user/charlotte"
},
"curie" : {
"name" : "controls"
"href" : "/to-do-items/1/rels/{rel}",
"templated" : true
},
"controls:mark-as-complete" : {
"href" : "#_controls/edit/complete"
},
"controls:edit-item" : {
"href" : "#_controls/edit/edit"
},
"controls:delete-task" : {
"href" : "#_controls/edit/delete"
}
},
"taskDescription" : "Buy some noodles",
"complete" : false,
"created" : 1383132444731,
"owner" : "Charlotte Gore",
"_controls" : {
"edit" : {
"complete" : {
"method" : "PUT",
"action" : "/to-do-items/1/complete",
"encoding" : "x-form-www-url-encoding"
},
"edit" : {
"method" : "PUT",
"action" : "/to-do-items/1/edit-task",
"encoding" : "x-form-www-url-encoding",
"properties" : [
{
"type" : "text",
"name" : "taskDescription",
"value" : "Buy some noodles"
}
]
},
"delete" : {
"method" : "DELETE",
"action" : "/to-do-items/1/delete-task",
"encoding" : "x-form-www-url-encoding"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment