Created
March 29, 2011 23:19
-
-
Save mikekelly/893552 to your computer and use it in GitHub Desktop.
a sketch of application/halo+json & application/halo+xml
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
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). |
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": { | |
"self": { "href": "/" }, | |
"basic": { "href": "/bleh" }, | |
"search": { "href": "/search_for;{searchTerm}" } | |
}, | |
"_controls": { | |
"widgetate": { | |
"href": "/widget/{newID}", | |
"method": "PUT", | |
"content-type": "application/xml", | |
"schema": null, | |
"template": "<widget>\\n <name>{{name}}</name>\\n\\n <blobs>\\n {{#blobs}}\\n <blob>\\n {{#first}}\\n <first>true</first>\\n {{/first}}\\n <contents>{{contents}}</contents>\\n </blob>\\n {{/blobs}}\\n </blobs>\\n\\n {{#is_empty}}\\n <note>This is an empty widget</note>\\n {{/is_empty}}\\n</widget>\\n" | |
} | |
} | |
} |
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
<resource href="/" xmlns:ex="http://example.org/rels/"> | |
<link rel="basic" href="/bleh" /> | |
<link rel="search" href="/search_for;{searchTerm}" /> | |
<control rel="widgetate" href="/widget/{newID}" method="PUT" content-type="application/xml" > | |
<widget> | |
<name>{{name}}</name> | |
<blobs> | |
{{#blobs}} | |
<blob> | |
{{#first}} | |
<first>true</first> | |
{{/first}} | |
<contents>{{contents}}</contents> | |
</blob> | |
{{/blobs}} | |
</blobs> | |
{{#is_empty}} | |
<note>This is an empty widget</note> | |
{{/is_empty}} | |
</widget> | |
</control> | |
</resource> |
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": { | |
"self": { "href": "/" }, | |
"basic": { "href": "/bleh" }, | |
"search": { "href": "/search_for;{searchTerm}" } | |
}, | |
"_controls": { | |
"widgetate": { | |
"href": "/widget/{newID}", | |
"method": "PUT", | |
"content-type": "application/xml", | |
"template-href": "/widget.template" | |
} | |
} | |
} |
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
<resource href="/" xmlns:ex="http://example.org/rels/"> | |
<link rel="basic" href="/bleh" /> | |
<link rel="search" href="/search_for;{searchTerm}" /> | |
<control rel="widgetate" | |
href="/widget/{newID}" | |
method="PUT" | |
template="/widget.template" | |
content-type="application/xml" /> | |
</resource> |
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
<widget> | |
<name>{{name}}</name> | |
<blobs> | |
{{#blobs}} | |
<blob> | |
{{#first}} | |
<first>true</first> | |
{{/first}} | |
<contents>{{contents}}</contents> | |
</blob> | |
{{/blobs}} | |
</blobs> | |
{{#is_empty}} | |
<note>This is an empty widget</note> | |
{{/is_empty}} | |
</widget> |
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": { | |
"self": { "href": "/" }, | |
"basic": { "href": "/bleh" }, | |
"search": { "href": "/search_for;{searchTerm}" } | |
}, | |
"_controls": { | |
"order": { | |
"href": "http://...", | |
"method": "POST", | |
"template-type": "http://shishkin.org/json-templates", | |
"template": { | |
"location": "", | |
"@location": { | |
"prompt": "Enter your postal code" | |
}, | |
"pickupTime": "", | |
"@pickupTime": { | |
"prompt": "When do you want to pickup your order?", | |
"type": "dateTime" | |
}, | |
"items": [ | |
{ | |
"name": "espresso", | |
"@name": { "options": [ "espresso", "cappuchino", "latte" ] }, | |
"size": "normal", | |
"@size": { "options": [ "normal", "grande", "venti" ] }, | |
"additions": [], | |
"@additions": { | |
"multiple": true, | |
"item": "string", | |
"options": [ "shot", "caramel", "vanilla", "decaf" ] | |
} | |
} | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mikekelly is the gist missing templated: true for the search-link by accident or is there a reason behind that?