-
Notifications
You must be signed in to change notification settings - Fork 42
API Documentation
Used to register the user for the application
URL : /auth/register/post
Method : POST
** Auth required** : NO
Data constraints
{
"Username" : "[Unique email address]",
"Password" : "[Password the user chooses]"
}
Data example:
{
"Username" : "[email protected]",
"Password" : "softwareengineering"
}
Code : 200 OK
Content examples
For user that wants to register their account without doing it before
{
"_id": "1234",
"Successful": "True"
}
For user that wants to register their account again
{
"_id": " ",
"Successful": "False"
}
User should not be able to register twice, and the username (email) of the account must be unique
Used to log the user into the application
URL : /auth/login
Method : POST
Auth required : YES
Data constraints:
{
"Username" : "[Unique email address]",
"Password" : "[Password the user chooses]"
}
Data example:
{
"Username" : "[email protected]",
"Password" : "softwareengineering"
}
Code : 200 OK
Content examples
For a user with ID 1234 on the database where the user has saved their login information:
{
"name": "Jason",
"email": "[email protected]",
"_id": "1234",
"Picture": "imgur.com/ao12r",
"Preferences": "blue",
"__v": "0"
}
Notes:
User first has to register
Get the user information such as email, id, profile pic string etc
URL : /user/:username
URL parameters : username = the username (email) of the current login
Method : GET
Auth required : YES
Code : 200 OK
Content examples
Returns the information of the user
{
"_id" : "1234",
"email": "[email protected]",
"name": "Lucy",
}
Used to update a user’s task
URL : /user/:name
URL parameters : name = the email of the user that needs update
Method : PUT
Auth required : YES
Data constraints:
{
"email": "[email]",
"name": "[name]",
"picture": "[pic]",
"themePreference": "[theme]"
}
Code : 200 OK
Content examples
For a successful update
{
"email" : "1234",
"Successful" : "True"
}
For an unsuccessful update
{
"email" : "1234",
"Successful" : "False"
}
Used to schedule a task
URL : /task/post
Method : POST
Auth required : NO
Data constraints:
{
"Task_id": [unique task id string],
"Title" : "Name for schedule task",
"Description" : "[Description for task]",
"Start_Date" : "[Time of creation]",
"End_Date" : "[Time to finish task by]",
"User_id" : "[Users google ID]",
"Location" : "[Location of their task]",
"Color" : "[Preferences of task color]"
}
Data example:
With all fields filled
{
"Task_id": 1234,
"Title" : "Eat dinner",
"Description" : "Eat dinner for tonight",
"Start_Date" : "2020-03-12T09:50:00.000",
"End_Date" : "2020-03-19T10:55:00.000",
"User_id" : "[email protected]",
"Location" : "Home",
"Color" : "Red"
}
With only mandatory fields filled
{
"Task_id": 1234,
"Title" : "Eat dinner",
"Description" : "Eat dinner for tonight",
"Start_Date" : "2020-03-12T09:50:00.000",
"End_Date" : "2020-03-19T10:55:00.000",
"User_id" : "[email protected]",
"Location" : "Home",
"Color" : " "
}
Code : 200 OK
Content examples
For a successful task scheduled
{
"_id" : "1234",
"Successful" : "True"
}
For an unsuccessful task scheduled
{
"_id" : "1234",
"Successful" : "False"
}
Used to update a user’s task
URL : /task/:taskid
URL parameters : taskid = the id of the task the user wants to change
Method : PUT
Auth required : NO
Data Constraints:
{
"task_id" : "1234",
"Title" : "[Name for schedule task]",
"Description" : "[Description for task]",
"Start_Date" : "[Time of creation]",
"End_Date" : "[Time to finish task by]",
"Location" : "[Location of their task]",
"Color" : "[Preferences of task color]"
}
Data example:
{
"task_id" : "1234",
"Title" : "Eat breakfast",
"Description" : "Eat breakfast for today",
"Start_Date" : "2020-03-12T08:50:00.000",
"End_Date" : "2020-03-19T09:55:00.000",
"Location" : "Home",
"Color" : "Red"
}
Code : 200 OK
Content examples
If the user enters a valid update and task ID
{
"task_id" : "1234",
"Successful" : "True"
}
Get the tasks of a user
URL : /task/get/:username
URL parameters : username = the username of the current login
Method : GET
Auth required : YES
Code : 200 OK
Content examples
Returns all the tasks the current user has
{
"task_id" : "1234",
"Title" : "Eat dinner",
"Description" : "Eat dinner for tonight",
"Start_Date" : "2020-03-12T21:50:00.000",
"End_Date" : "2020-03-12T22:55:00.000",
"User_id" : "[email protected]",
"Location" : "Home",
"Color" : "Red"
},
{
"task_id" : "1231241244",
"Title" : "Eat lunch",
"Description" : "Eat lunch for today",
"Start_Date" : "2020-03-12T13:50:00.000",
"End_Date" : "2020-03-12T11:55:00.000",
"User_id" : "[email protected]",
"Location" : "Home",
"Color" : "Red"
}
Used to delete a user’s task
URL : /task/:taskid
URL parameters : taskid = the id of the task the user wants to change
Method : DELETE
Auth required : NO
Data Constraints:
{
"id" : "[ID of the task]"
}
Data example:
{
"id" : "1234"
}
Code : 200 OK
Content examples
If the user enters a valid task ID
{
"task_id" : "1234",
"Deleted" : "True"
}
If the user enters an invalid task ID
{
"task_id" : "1234",
"Deleted" : "False"
}
Takes user to google sign in page. Upon sign in redirects user to main calendar page.
URL : /api/auth/google
Method : GET
Auth required : NO
Content examples
Redirects user to the /calendar page with the following URL parameters
email : base 64 encoded email of signed in user
accessToken : bearer token to be passed in header of subsequent requests to authorise user