Skip to content

Instantly share code, notes, and snippets.

View mikekelly's full-sized avatar

Mike Kelly mikekelly

View GitHub Profile
{
"1":{
"key":{
"gray":"No service on Saturday"
},
"out":{
"stops":[
"Liberation Station",
"La Mare Slip",
"Le Bourg",
<resource href="documents/123/versions" xmlns="http://hal.schema.huddle.net/2011/02/">
<link rel="parent" href="documents/123" />
<resource rel="documentVersion" title="a new title" href="documents/123/versions#543">
<link rel="content" href="..." />
<link rel="thumb" href="..." />
<resource title="Barry Potter" rel="updated-by actor" href="...">
<link rel="avatar" href="..." type="image/jpg" />
<link rel="alternate" href="..." type="text/html" />
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
<resource href="/">
<motd>Welcome. Today's special offer: by 600 flat whites and get an extra free.</motd>
<link rel="rb:orderList" href="/order-list" />
</resource>
@mikekelly
mikekelly / min_hal.json
Created June 15, 2011 16:41
minimum valid hal representation
{ "_links": { "self": { "href": "http://example.com/" } } }
@mikekelly
mikekelly / hal_example.json
Created June 15, 2011 13:47
Example use of HAL's JSON variant
{
"_links": {
"self": { "href": "/orders" },
"next": { "href": "/orders?page=2" },
"search": { "href": "/orders?id={order_id}" }
},
"_embedded": {
"order": [
{
"_links": {
@mikekelly
mikekelly / min_hal.xml
Created June 14, 2011 21:25
minimum valid hal representation
<resource href="http://example.com/" />
@mikekelly
mikekelly / example.lisp
Created April 21, 2011 11:12
Example resource definition
(defresource "example"
(GET (lambda (req)
'(200
(:content-type "text/plain")
("This is the example resource"))))
(POST (lambda (req)
'(200
(:content-type "text/plain")
("Thanks for posting something")))))
@mikekelly
mikekelly / 0_README.txt
Created March 29, 2011 23:19
a sketch of application/halo+json & application/halo+xml
I've added a control element with these properties/attributes:
method ; method to use for generated request e.g. POST/PUT/DELETE
content-type ; (optional) content-type of the request body generated by the template (defaults to application/hal+xml)
schema ; contains schema for data submitted to template
template ; (optional) A string or object representing the template or form for the request.
template-href ; (optional) Contains a URI which links to a resource where the template or form can be fetched.
template-type ; (optional) URI used to identify the template format in use (defaults to mustache).