Skip to content

Instantly share code, notes, and snippets.

@mamund
Created August 25, 2014 15:16
Show Gist options
  • Save mamund/fee16d9138b17433d3b2 to your computer and use it in GitHub Desktop.
Save mamund/fee16d9138b17433d3b2 to your computer and use it in GitHub Desktop.
supporting custom templates in Cj
{
"collection" : {
"version" : "1.0",
"href" : "http://api.example.com/list",
"links" : [
{"rel" : "payment", "href" : "http://api.example.com/payment", "prompt" : "Select Payment Method"}
],
"items" : [
...
]
}
}
{
"collection" : {
"version" : "1.0",
"href" : "http://api.example.com/payment",
"links" : [
{"rel" : "collection", "href" : "http://api.example.com/list", "prompt" : "Return to Shopping Cart"}
],
"template" : [
{"name" : "cash", "value" : "", "prompt" : "Pay with cash", "regexp" : "^(?:true|false)$"},
{"name" : "check", "value" : "", "prompt" : "Pay with check", "regexp" : "^(?:true|false)$"},
{"name" : "billme", "value" : "", "prompt" : "Bill me later", "regexp" : "^(?:true|false)$"}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment