Skip to content

Revilo2157/FitnessAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Duke Fitness App API

Server-side API to establish a leaderboard and send challenges to other users.

Deployed at: https://152.3.69.115:8081/

Usage:

Ping:

Used to test if the API is online.

  https://152.3.69.115:8081/api/ping  

New:

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   

Challenge:

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  

Stats:

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  

Update:

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 

Delete:

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      

Leaderboard:

Returns the leaderboard.

  https://152.3.69.115:8081/api/leaderboard  

Reset:

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  

Return Values:

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:

{  
   Stats: [{  
         workout: String,  
         amount: Int  
      },  
   ] 
   
   Challenges: [{  
         opponent: String,  
         workout: String,  
         amount: Int,
         you: Int,
         them: Int,
         completed: Bool,
         first: String
      },  
   ]  
}

Leaderboards

{
   General: [{
         workout: String, 
         username : String, 
         amount : Int
      },
   ],

   Workouts: [{
         workout: String, 
         data: [{
               username: String, 
               amount: Int
            },
         ]
      },
   ]
}

About

Server Side Duke Fitness Application for CS 290

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published