-
Notifications
You must be signed in to change notification settings - Fork 4
Collection JSON Graphviz Hypermedia API
jvelilla edited this page Feb 22, 2013
·
11 revisions
The actual design allows users to:
- Register a new user
- Add, Update, Delete graph definitions (only for registered users)
- Retrieve a fix set of representations, pdf, jpg, png, gif
- Anonymous users can browse the API, and retrieve the graph representation, but they can't Create/Update/Delete them.
- Paging graph results
A simplified state machine is described here
We are using Basic Authentication, we plan to extend it with other options like OAuth, OpenId, etc.
- The home page
- Template for register a new user
- The list of graphs (pages)
- A single graph selected from the previous list
- The list of graph per user
- A single graph selected from the previous list per user
- Template for create a new graph
- Template for updating an existing graph
- Delete an existing graph
TODO
- template for queries
GET /
{
"collection": {
"version": "1.0",
"href": "http://127.0.0.1:8190/",
"links": [
{"href": "http://127.0.0.1:8190/", "rel": "home", "prompt": "Home API"},
{"href": "http://127.0.0.1:8190/graph", "rel": "graphs", "prompt": "Home Graph"},
{"href": "http://127.0.0.1:8190/register", "rel": "register", "prompt": "User Register"},
{"href": "http://127.0.0.1:8190/login", "rel": "login", "prompt": "User Login"}
]
}
}
GET /graphs
{
"collection": {
"version": "1.0",
"href": "http://127.0.0.1:8190/graph",
"links": [
{"href": "http://127.0.0.1:8190/", "rel": "home", "prompt": "Home API"},
{"href": "http://127.0.0.1:8190/register", "rel": "register", "prompt": "User Register"},
{"href": "http://127.0.0.1:8190/login", "rel": "login", "prompt": "User Login"},
{"href": "http://127.0.0.1:8190/graph?offset=0", "rel": "first", "prompt": "Page 1 of 5"},
{"href": "http://127.0.0.1:8190/graph?offset=5", "rel": "next", "prompt": "Page 2 of 5"},
{"href": "http://127.0.0.1:8190/graph?offset=20", "rel": "last", "prompt": "Page 5 of 5"}
],
"items": [
{
"href": "http://127.0.0.1:8190/graph/1",
"data": [
{"name": "description", "prompt": "Description", "value": "tes"},
{"name": "content", "prompt": "Graph", "value": "digraph revolution { B [label=\"The boss\"] ; E [label=\"The employee\"]; B ->E [label=\"commands\", dir=back, fontcolor=red];} "},
{"name": "title", "prompt": "Title", "value": "cool"}
],
"links": [
{
"href": "http://127.0.0.1:8190/graph/1.png",
"rel": "Image",
"prompt": "Graph",
"name": "Title",
"render": "image/png"
},
{
"href": "http://127.0.0.1:8190/graph/1.jpg",
"rel": "Image",
"prompt": "Graph",
"name": "Title",
"render": "image/jpg"
},
{
"href": "http://127.0.0.1:8190/graph/1.pdf",
"rel": "Image",
"prompt": "Graph",
"name": "Title",
"render": "application/pdf"
},
{
"href": "http://127.0.0.1:8190/graph/1.gif",
"rel": "Image",
"prompt": "Graph",
"name": "Title",
"render": "application/gif"
}
]
},
....
}
}
References [1] http://amundsen.com/media-types/collection/