Skip to content
mjsmith707 edited this page Nov 25, 2014 · 5 revisions

####Contest Permission Field####
0 = Friends Only Contest
-1 = Public Contest
-2 = Locked Contest
username = Private contest between two users

####Create User####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“createuser”,“reqparam1”:“[email protected]”}

Return Format:
{"RESULT": "1005"} = Create user successful
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1003"} = SQL Error {"RESULT": "1006"} = User Already Exists
{"RESULT": "1008"} = Email Already In Use
{"RESULT": "1004"} = Empty Required Parameter

####Authenticate User####
JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:"authenticate"}

Return Format:
{"RESULT": "1009"} = Authentication successful
{"RESULT": "1010"} = Authentication failed

####Create Contest####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“createcontest”,“reqparam1”:“contest name”,“reqparam2”:"permission"}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1003"} = SQL Error
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation), Currently all permission related errors {"CONTESTKEY":"int"} = Contest created successfully

####Get My Contests####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:"getmycontests"}

Return Format:
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1003"} = SQL Error

On Success: { “contests” : [{ “contestID” : “490”, “contestName” : “contest name”, “image1” : “NULL”, “image2” : “NULL”, “userOne” : “msmith”, “userOneID” : “27”, “userTwo” : "", “userTwoID” : “0” , “starttime” : “yyyy-mm-dd hh:mm:ss” , “endtime” : “yyyy-mm-dd hh:mm:ss” } ] }

####Get Contest####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“getcontest”,“reqparam1”:“int contestid”}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1003"} = SQL Error (invalid contestid)
{"RESULT": "1013"} = Bad Parameter (contestid not int), Currently all permission related error

On Success:
{ “contest” : { “contestID” : “490”, “contestName” : “contest name”, “image1” : “NULL”, “image2” : “NULL”, “userOne” : “msmith”, “userOneID” : 27, “userOneScore” : “0”, “userTwo” : "", “userTwoID” : 0, “userTwoScore” : “0” , “starttime” : “yyyy-mm-dd hh:mm:ss” , “endtime” : “yyyy-mm-dd hh:mm:ss” } } }

####Update Image####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“updateimage”,“reqparam1”:“int contestid”,“reqparam2”:“base64image”,“reqparam3”:“slot (1 or 2, left or right),“reqparam4”:“base64thumbnail”}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1013"} = Bad Parameter (Contestid/slot not ints) (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "999"} = Internal Error (Unable to insert image into table for whatever reason)
{"RESULT": "1012"} = Update Image Failed
{"RESULT": "1011"} = Update Image Success

####Get Image####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“getimage”,“reqparam1”:“int contestid”,“reqparam2”:“int slot”}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1013"} = Bad Parameter (Contestid/slot not ints) (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "999"} = Internal Error (Unable to insert image into table for whatever reason)
{"image": "base64image"} = Returned fullsize image associated with contest/slot

####Add Friend#### Also Accepts Friend Request

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“addfriend”,“reqparam1”:“friend’s username”}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1003"} = SQL Error
{"RESULT": "1000"} = Successfully created friend request

####Remove Friend#### Also Declines Friend Request

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:“removefriend”,“reqparam1”:“friend’s username”}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1003"} = SQL Error
{"RESULT": "1000"} = Successfully deleted friend

####Get My Friends####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:"getmyfriends"}

Return Format:
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1003"} = SQL Error

{ “friends” : [{ “name” : “username” } ] }

####Get Friend Requests####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:"getfriendrequests"}

Return Format:
{"RESULT": "1004"} = Empty Required Parameter
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1003"} = SQL Error

{ “friends” : [{ “name” : “username” } ] }

####Voting!####

JSON Format: {"username":“msmith”,“password”:“hello”,“requestid”:“vote”,“reqparam1”:“contestid”,“reqparam2”:"slot"}

Return Format:
{"RESULT": "1001"} = Voting Failed (Already voted or no permission)
{"Scores":{"user1":“1”,“user2”:"1"}}

####Get Top Contests####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:"gettopcontests"}

Return Format:
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1003"} = SQL Error

On Success: { “contests” : [{ “contestID” : “490”, “contestName” : “contest name”, “image1” : “NULL”, “image2” : “NULL”, “userOne” : “msmith”, “userOneID” : “27”, “userTwo” : "", “userTwoID” : “0” , “starttime” : “yyyy-mm-dd hh:mm:ss” , “endtime” : “yyyy-mm-dd hh:mm:ss” } ] }

####Get Random Contests####

JSON Format:
{"username":“msmith”,“password”:“hello”,“requestid”:"getrandomcontests"}

Return Format:
{"RESULT": "1013"} = Bad Parameter (Failed SQL sanitation)
{"RESULT": "1002"} = Failed to connect to database
{"RESULT": "1003"} = SQL Error

On Success: { “contests” : [{ “contestID” : “490”, “contestName” : “contest name”, “image1” : “NULL”, “image2” : “NULL”, “userOne” : “msmith”, “userOneID” : “27”, “userTwo” : "", “userTwoID” : “0” , “starttime” : “yyyy-mm-dd hh:mm:ss” , “endtime” : “yyyy-mm-dd hh:mm:ss” } ] }

Clone this wiki locally