Created
March 24, 2012 06:37
-
-
Save eatnumber1/2179092 to your computer and use it in GitHub Desktop.
Photohunt 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
Semi-formally, the JSON communicated will follow the following EBNF | |
(https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) grammar (note | |
that this is only roughly EBNF): | |
(* Valid error codes *) | |
ERR_SUCCESS = 0 (* No error occurred *) | |
ERR_UNSPEC = 1 (* Unspecified error. Message contains additional information *) | |
ERR_NOTAUTH = 2 (* Authorization token invalid *) | |
ERR_GAMEOVER = 3 (* Photohunt competition is over. No judged submissions allowed *) | |
(* Additional error codes will be added during development *) | |
(* Example | |
{ | |
code=0, | |
message="No Error", | |
data=nil | |
} | |
*) | |
response = "{", | |
"code=", ( | |
ERR_SUCCESS | | |
ERR_UNSPEC | | |
ERR_NOTAUTH | | |
ERR_GAMEOVER | |
), ",", | |
"message=", "\"", string, "\"", ",", | |
"data=", data, | |
"}"; | |
data = ( "{", clue-list, "}" ) | ( "\"", photo_id, "\"" ) | "nil"; | |
(* Example | |
{ | |
clues=[ | |
{ | |
id=1, | |
bonusid=[ 1, 2, 5 ] | |
} | |
], | |
judge=False, | |
notes="Pedobear is hiding behind the sign" | |
} | |
*) | |
photo-metatadata = "{", | |
"clues=", "[", { | |
"{", | |
"id=", clueid, ",", | |
"bonusid=", "[" { | |
bonusid, | |
}, "]", | |
"}", | |
}, "]", ",", | |
"judge=", ( "False" | "True" ), "," | |
"notes=", "\"", string, "\"" | |
"}"; | |
(* Example | |
[ | |
{ | |
id=1, | |
description="Your team on Marketplace Mall island.", | |
points=100, | |
bonus=[ | |
{ | |
id=1, | |
description="with a duck", | |
points=10 | |
} | |
], | |
tags=[ "Location", "Duck" ] | |
} | |
] | |
*) | |
clue-list = "[", { | |
"{", | |
"id=", number, ",", | |
"description=", "\"", string "\"", ",", | |
"points=", number, ",", | |
"bonus=", "[", { | |
"{", | |
"id=", number, ",", | |
"description=", "\"", string, "\"", ",", | |
"points=", number, | |
"}", | |
}, "]", | |
"}", | |
}, "]"; | |
(* Example - Uses RFC 2616 dateTime format | |
{ | |
"team": "faggot", | |
"startTime": "<start-time>", | |
"endTime": "<end-time>", | |
"maxPhotos": 30, | |
"maxJudgeablePhotos": 24 | |
} | |
*) | |
info = TODO | |
The GET/PUT requests will look like the following: | |
Content-Type: application/json | |
photohunt.csh.rit.edu/api | |
PUT /photos/new?token=:oauth_token | |
-> Photo's binary data | |
<- response (repsponse=photo_id) | |
PUT /photos/edit?id=:photo_id&token=:oauth_token | |
-> photo-metadata | |
<- response (data=nil) | |
GET /info?token=:oauth_token | |
<- response (data=info) | |
GET /clues | |
<- response (data=clues) | |
TODO: OAuth registration | |
vim: sw=4 ts=4 sts=4 tw=80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment