Created
March 3, 2012 03:26
-
-
Save mamund/1964134 to your computer and use it in GitHub Desktop.
Conery API Challenge - Collection+JSON API
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
/* 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: | |
- 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