POST
/user/create
(Create a new user's entry in the DB)
Name Required Data Type Description name yes string Name of the user phNo yes number Phone number of the user yes string Email of the user
HTTP Code Response 201
{"message": "Created user."}
400
{"message": "Email or Phone Number already exists."}
500
{"message": "Internal Server Error!"}
POST
/user/login
(Login a user)
Name Required Data Type Description token yes string User's google idToken deviceToken yes string User's device FCM Token
HTTP Code Response 200
{"message": "Logged in user.", "token": "xyz"}
404
{"message": "User not found in the DB."}
500
{"message": "Internal Server Error!"}
PUT
/user/update
(Update the user's details)
Bearer JWT Token
Name Required Data Type Description name no string Name of the user phNo no number Phone number of the user batch no number Year of admission of the user
HTTP Code Response 200
{"message": "Updated user."}
400
{"message": "Email or Phone Number already exists."}
404
{"message": "User not found in the DB."}
500
{"message": "Internal Server Error!"}
GET
/user/find/{email}
(Get the user details of self)
Bearer JWT Token
Name Required Data Type Description yes string Email of self
HTTP Code Response 200
{"message": "Found user.", "name": "John Doe", "email": "[email protected]", phNo: 9999999999, batch: 2021, rides: [...], rideRequests: [...]}
404
{"message": "User not found in the DB."}
500
{"message": "Internal Server Error!"}
GET
/user/find/{email}
(Get the details of a different user)
Bearer JWT Token
Name Required Data Type Description yes string Email of another user
HTTP Code Response 200
{"message": "Found user.", "name": "John Doe", "email": "[email protected]", phNo: 9999999999, batch: 2021, rides: [...]}
404
{"message": "User not found in the DB."}
500
{"message": "Internal Server Error!"}
POST
/ride/create
(Post a ride)
Bearer JWT Token
Name Required Data Type Description fromPlace yes number Enum of the place leaving from toPlace yes number Enum of the place arriving at seats yes number Number of seats available for other users to join timeRangeStart yes string "YYYY-MM-DD hh:mm:ss"
-formatted timestamp of the start of the time range for departuretimeRangeStop yes string "YYYY-MM-DD hh:mm:ss"
-formatted timestamp of the end of the time range for departuredescription no string Optional caption to the post
HTTP Code Response 201
{"message": "Posted ride.", "id": "xyz"}
403
{"message": "User not found in the DB."}
500
{"message": "Internal Server Error!"}
PUT
/ride/update/{id}
(Update the ride's details)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
Name Required Data Type Description fromPlace no number Enum of the place leaving from toPlace no number Enum of the place arriving at seats no number Number of seats available for other users to join timeRangeStart no string "YYYY-MM-DD hh:mm:ss"
-formatted timestamp of the start of the time slottimeRangeStop no string "YYYY-MM-DD hh:mm:ss"
-formatted timestamp of the end of the time slotdescription no string Optional caption to the post
HTTP Code Response 200
{"message": "Updated ride."}
401
{"message": "Unauthorized to edit this ride."}
403
{"message": "Ride not found in the DB."}
403
{"message": "User not found in the DB."}
500
{"message": "Internal Server Error!"}
GET
`/ride/find/{id}`
(Fetch the details of a particular ride posted by self)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
HTTP Code Response 200
{"message": "Fetched ride.", "id": "xyz", , "originalPoster": {...}, "fromPlace": x, "toPlace": y, "seats": z, "timeRangeStart": x, "timeRangeStop": y, "participants": [...], "participantQueue": [...], "status": true, "createdAt": "YYYY-MM-DD hh:mm:ss", "updatedAt": "YYYY-MM-DD hh:mm:ss", "description": "xyz"}
403
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}
GET
`/ride/find/{id}`
(Fetch the details of a particular ride posted by another user)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
HTTP Code Response 200
{"message": "Fetched ride.", "id": "xyz", , "originalPoster": {...}, "fromPlace": x, "toPlace": y, "seats": z, "timeRangeStart": x, "timeRangeStop": y, "participants": [...], "status": true, "createdAt": "YYYY-MM-DD hh:mm:ss", "updatedAt": "YYYY-MM-DD hh:mm:ss", "description": "xyz"}
403
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}
GET
/ride/search?
(Search for posts with filters)
Bearer JWT Token
Name Required Data Type Description fromPlace no number Enum of the place leaving from toPlace no number Enum of the place arriving at startTime no string "YYYY-MM-DD hh:mm:ss"
-formatted timestamp of the start of a time range to search withinendTime no string "YYYY-MM-DD hh:mm:ss"
-formatted timestamp of the end of a time range to search withinavailableSeats no number Render only those rides with atleast this many free seats startAtRide no number Starting index for pagination (inclusive) endAtRide no number Ending index for pagination (inclusive) orderBy no number 1
returns rides sorted by time of posting,2
returns rides sorted by time of departure,3
returns rides sorted by number of seats available. Use the corresponding negative numbers for descending order
HTTP Code Response 200
{"message": "Fetched rides.", "rides": [...]}
500
{"message": "Internal Server Error!"}
DELETE
/ride/delete/{id}
(Delete a ride you posted)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
HTTP Code Response 200
{"message": "Deleted ride."}
401
{"message": "Unauthorized to delete this ride."}
404
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}
DELETE
/ride/kick/{id}
(Remove self from a ride you were accepted into)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
Name Required Data Type Description yes email of self
HTTP Code Response 200
{"message": "Removed from ride participants."}
400
{"message": "User has not been accepted into this ride."}
400
{"message": "Cannot kick user from his own ride."}
403
{"message": "Unauthorized to kick users from this ride."}
404
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}
DELETE
/ride/kick/{id}
(Kick a participant out of a ride you created after accepting the user)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
Name Required Data Type Description yes email of the user being kicked
HTTP Code Response 200
{"message": "Removed from ride participants."}
400
{"message": "User has not been accepted into this ride."}
400
{"message": "Cannot kick user from his own ride."}
403
{"message": "Unauthorized to kick users from this ride."}
404
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}
GET
/ride/join/{id}
(Make a request to join another user's ride)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
HTTP Code Response 200
{"message": "Requested to join this ride."}
400
{"message": "Cannot request to join your own ride."}
400
{"message": "User has already requested to join this ride."}
400
{"message": "User has already been accepted into this ride."}
404
{"message": "User not found in the DB."}
404
{"message": "Ride not found in the DB."}
405
{"message": "Ride is full."}
500
{"message": "Internal Server Error!"}
POST
/ride/accept/{id}
(Accept another user's request to join your ride)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
Name Required Data Type Description yes email of the user being accepted
HTTP Code Response 200
{"message": "Accepted into this ride."}
401
{"message": "Unauthorized to accept users into this ride."}
404
{"message": "User has not requested to join this ride."}
404
{"message": "Ride not found in the DB."}
405
{"message": "Ride is full."}
500
{"message": "Internal Server Error!"}
DELETE
/ride/remove/{id}
(Decline another user's request to join your ride)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
Name Required Data Type Description yes email of the user being declined
HTTP Code Response 200
{"message": "Removed from request queue."}
400
{"message": "Cannot remove user from his own ride."}
400
{"message": "User has not requested to join this ride."}
403
{"message": "Unauthorized to remove users from this ride."}
404
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}
DELETE
/ride/remove/{id}
(Withdraw a request made by you to another user's ride)
Bearer JWT Token
Name Required Data Type Description id yes string ID of the ride
Name Required Data Type Description yes email of self
HTTP Code Response 200
{"message": "Removed from request queue."}
400
{"message": "Cannot remove user from his own ride."}
400
{"message": "User has not requested to join this ride."}
403
{"message": "Unauthorized to remove users from this ride."}
404
{"message": "Ride not found in the DB."}
500
{"message": "Internal Server Error!"}