Skip to content

Instantly share code, notes, and snippets.

@mikekelly
Created September 30, 2012 19:25
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikekelly/3808215 to your computer and use it in GitHub Desktop.
Save mikekelly/3808215 to your computer and use it in GitHub Desktop.
{
"_links": {
"self": { "href": "/foo" },
},
"_controls": {
"attack": {
"target": "/attacks",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"schema": { /*_json_schema_doc_here_*/ }
}
}
}
{
"_links": {
"self": { "href": "/" },
"example": { "href": "/example" }
},
"_controls": {
"widgetate": {
"target": "/widget/{newID}",
"method": "PUT",
"headers": {
"Content-Type": "application/xml"
},
"body": "<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"
}
}
}
@matthewlmcclure
Copy link

JSON Hyper-Schema looks like it includes nearly everything in the _controls example above. Notably, it specifies encType and mediaType rather than arbitrary headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment