Server-side API to establish a leaderboard and send challenges to other users.
Deployed at: https://152.3.69.115:8081/
Used to test if the API is online.
https://152.3.69.115:8081/api/ping
Creates a new user file on the server. Throws an exception if the user already exists.
Inputs:
Username: The username to create the file for.
https://152.3.69.115:8081/api/new/username
Creates a challenge between two different users. Throws an exception if either user does not exist in the server.
Inputs:
Challenger: The user that initiated the challenge.
Challenged: The user that was challenged.
Workout: Which workout is to be done.
Amount: How many reps of the above workout.
https://152.3.69.115:8081/api/challenge/challenger/challenged/workout/amount
Returns the user's information file. Throws an exception if the user does not exist in the server.
Inputs:
Username: The user whose data is to be returned.
https://152.3.69.115:8081/api/stats/username
Updates the user's information to include newly done workouts. Throws an exception if the user does not exist in the server.
Inputs:
Username: The user to update.
Workout: Which workout to update.
Amount: How many reps of the above workout.
https://152.3.69.115:8081/api/update/username/workout/amount
Deletes the information of the user specified in the username field.
Inputs:
Username: The user whose data is to be deleted.
https://152.3.69.115:8081/api/delete/username
Returns the leaderboard.
https://152.3.69.115:8081/api/leaderboard
Resets the leaderboard. This does not affect any user information. This is used to test the other methods.
https://152.3.69.115:8081/api/reset
Most messages will be responded to with a message stating if they were successful or not. The exceptions to this are errors where an empty message is sent as well as information replies. There the JSON will follow this structure:
{
Stats: [{
workout: String,
amount: Int
},
]
Challenges: [{
opponent: String,
workout: String,
amount: Int,
you: Int,
them: Int,
completed: Bool,
first: String
},
]
}
{
General: [{
workout: String,
username : String,
amount : Int
},
],
Workouts: [{
workout: String,
data: [{
username: String,
amount: Int
},
]
},
]
}