Skip to content

Instantly share code, notes, and snippets.

@mamund
Created March 3, 2012 03:26
Show Gist options
  • Save mamund/1964134 to your computer and use it in GitHub Desktop.
Save mamund/1964134 to your computer and use it in GitHub Desktop.
Conery API Challenge - Collection+JSON API
/* Rob Conery API Sample */
// see docs at bottom of file
// based on Collection+JSON media type
// http://www.amundsen.com/media-types/collection/
// login template
// use this data to execute HTTP BASIC over HTTPS
template : [
{name : "email", value : "..."},
{name : "password", value : "..."}
]
// queries
queries : [
{ rel : "browse-all-productions", href: "..."},
{ rel : "browse-by-categories", href : "...",
data : [
{name : "category", value : "...",
options : ["Microsoft", "Ruby", "Javascript", "Mobile"]
}
]
},
{rel : "new-episodes", href : "..."}
]
// productions collection
items : [
{
href : "...",
data : [
{name : "type", value : "production"},
{name : "name", value : "..."},
{name : "status", value : "allowed"}
]
},
{
href : "...",
data : [
{name : "type", value : "production"},
{name : "name", value : "..."},
{name : "status", value : "allowed"}
]
}
]
// episode collection
items : [
{
href : "...",
data : [
{name : "type", value : "episode"},
{name : "name", value : "..."}
]
},
{
href : "...",
data : [
{name : "type", value : "episode"},
{name : "name", value : "..."}
]
}
]
// video collection
items : [
{
href : "...",
data : [
{name : "type", value : "video"},
{name : "name", value : "..."}
]
},
{
href : "...",
data : [
{name : "type", value : "video"},
{name : "name", value : "..."}
]
}
]
/*
Assume a starting URI supplied by the server (or added as a var)
Conery vocabulary:
- email
- password
- category
- name
- type (production, episode, video)
- status (allowed, not-allowed)
Conery queries:
- browse-by-categories
- browse-all-productions
- new-episodes
write a client that
- MUST be ab;e tp process the Collection+JSON media type
- MUST render and activate the login template (using HTTPS BASIC AUTH)
- MUST render and activate the the queries (using HTTP.GET + query string)
- MUST render and activate the links (using HTTP.GET)
- MUST render the collections
+ SHOULD understand type="allowed|not-allowed"
- MUST render/play "video"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment