Our endpoints send and receive account- and scores-related data.
Endpoints accept and return JSON as request data. Authenticated endpoints want JSON Web Tokens, which our POST /accounts/register
and POST /accounts/log-in
endpoints return to us.
"easyMajor", "easyMajorInv", "easyMinor", "easyMinorInv", "intermediateMinor",
"intermediateMinorInv", "hardMajor", "hardMajorInv", "hardMinor", "hardMinorInv",
"allChords", "allChordsInv"
{
"name": {String},
"scores": {
gameType: {
"totalClicks": {Number},
"nAnsweredRight": {Number},
"nQuestionNumber": {Number},
*"winRatio": {Number}
}
}
}
*We don't include winRatio
in PUT
requests; it's calculated by the server and returned by GET requests
Returns all the (non-password) data associated with an account. Data is of type score
. Identical to GET /my-scores
endpoint
Authenticated
success => score
, 200
status
error => 404
, 401
, 500
status code
Log in endpoint; (obviously) for existing accounts.
request body => { "name": {String}, "password": {String} }
success => JWT token, 201
status code
error => 404
, 401
, 500
status code
Creates an account and returns the relevant JWT.
request body => { "name": {String}, "password": {String} }
success => JWT token, 200
success
error => 400
, 409
, 500
status code
Change an account password.
Authenticated
request body => { "name": {String}, "newPassword": {String} }
success => 204
status code
error => 400
, 500
status code
Deletes an account and associated data.
Authenticated
success => 200
status
error 404
, 500
status
Returns all the (non-password) data associated with an account. Data is of type score
. Identical to GET /accounts
endpoint
Authenticated
success => score
, 200
status
error => 404
, 401
, 500
status code
Updates a specific gameType
's scores'. Submit only one gameType
, at once.
Authenticated
body => score
, with updated data
success => 200
status code
error => 400
, 304
, 500
status code
success => an array of score
s of the given :gameType
, ordered by win percentage.
error => 500
status
-DR, 2017