Created
June 18, 2012 21:33
-
-
Save vlucas/2950863 to your computer and use it in GitHub Desktop.
Hypermedia API with "form"-like descriptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_links":{ | |
"add":{ | |
"title":"Add Budget", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets", | |
"method":"post", | |
"parameters":{ | |
"name":{ | |
"type":"string", | |
"required":true | |
}, | |
"amount":{ | |
"type":"float", | |
"required":true, | |
"length":"10,2" | |
} | |
} | |
} | |
}, | |
"items":[ | |
{ | |
"id":73, | |
"name":"Stroopwafels", | |
"amount":120, | |
"balance":70, | |
"_links":{ | |
"self":{ | |
"rel":"budget", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/73", | |
"method":"get" | |
}, | |
"delete":{ | |
"title":"Delete", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/73", | |
"method":"delete" | |
}, | |
"transactions":{ | |
"title":"Transactions", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/73\/transactions", | |
"method":"get" | |
}, | |
"add_transaction":{ | |
"title":"Add Transaction", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/73\/transactions", | |
"method":"post", | |
"parameters":{ | |
"name":{ | |
"type":"string", | |
"required":true | |
}, | |
"amount":{ | |
"type":"float", | |
"required":true, | |
"length":"10,2" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"id":74, | |
"name":"Souvenirs ", | |
"amount":200, | |
"balance":200, | |
"_links":{ | |
"self":{ | |
"rel":"budget", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/74", | |
"method":"get" | |
}, | |
"delete":{ | |
"title":"Delete", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/74", | |
"method":"delete" | |
}, | |
"transactions":{ | |
"title":"Transactions", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/74\/transactions", | |
"method":"get" | |
}, | |
"add_transaction":{ | |
"title":"Add Transaction", | |
"href":"http:\/\/localhost\/brightb.it\/budgetapp\/budgets\/74\/transactions", | |
"method":"post", | |
"parameters":{ | |
"name":{ | |
"type":"string", | |
"required":true | |
}, | |
"amount":{ | |
"type":"float", | |
"required":true, | |
"length":"10,2" | |
} | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, this is quite interesting - I've also been doing some similar sketching to add something form-like on top of HAL:
https://gist.github.com/893552