Authentication
/api/auth/login
Request type: GET
Description
Redirects the user to the IDP’s sign in page
/api/auth/token
Description
Exchanges the authorisation code and state from the login endpoint for an access token and information about the user
Query Parameters
Name | Description |
---|---|
code | The authorisation code received from the login endpoint |
state | The state received from the login endpoint |
/api/auth/logout
Request type: GET
Description
Invalidate the provided access token to log the user out.
Friends
/api/friend/:userId
Request type: GET
Description
Returns a list of all a user’s friends
Path Variables
Name | Description |
---|---|
userId | The ID of the user |
Result
Code | Format |
---|---|
200 | { "status": Success message for finding the user. "data": An array of User objects who are friends. } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/friend
Request type: POST
Description
Adds a user to another user’s friend list
Body Parameters
Name | Description |
---|---|
senderId | The ID of the user who accepted the friend request |
sendeeId | The ID of the user who sent the friend request |
Result
Code | Format |
---|---|
200 | { "status": "Successfully added users as friends!", "data": { "id": sendee id is sent here } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/friend
Request type: DELETE
Description
Removes a user from a user’s friend list
Body Parameters
Name | Description |
---|---|
senderId | The ID of the user who wants to remove a friend |
sendeeId | The ID of the friend to remove |
Result
Code | Format | |
---|---|---|
200 | { "status": "Successfully removed users as friends!", "data": { "id": the sendee Id who is removed from friends. } } | |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/friend/request
Request type: POST
Description
Send a friend request to a user
Body Parameters
Name | Description |
---|---|
senderId | The ID of the user who wants to send the friend request |
sendeeId | The ID of the user to send the friend request to |
Result
Code | Format |
---|---|
200 | { "status": "Successfully sent friend request!", "data": { "id": The sendee Id } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/friend/request
Request type: DELETE
Description
Delete an incoming friend request
Body Parameters
Name | Description |
---|---|
requestId | The ID of the friend request |
Result
Code | Format |
---|---|
200 | { "status": "data": } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/friend/search
Request type: GET
Description:
Returns a list of all users with their names/zIDs matching the search query (TBD)
Query Parameters
Name | Description |
---|---|
userId | The user’s user ID |
name | The user’s full name (separated by underscores) |
User Information
/api/user/profile/:userId
Request type: GET
Description:
Returns information about the current user
Path Variables
Name | Description |
---|---|
userId | The ID of the user |
Result
This is a typical format a valid User
will be sent back as a response.
Code | Format |
---|---|
200 | { "status": A message detailing the success of the operation performed. "data": { "google_uid": The user's google id as per the authentication process. "firstname": The user's first name. "lastname": The user's surname / other words that make up their name. "email": The user's authenticated email address. "profileURL": The link to fetch user's profile picture. "createdAt": The time and date the user's information stored in database (extended ISOString format). "lastLogin": The last time the user logged in. (extended ISO string format). "loggedIn": The status of user's logged in state. It is a derived (Can be checked with the previous field) boolean field. "friends": An array of user google_uid's. "settings": The settings object, look below for a more detailed documentation on the settings object. "timetables": An array of timetable objects. Look below for a more detailed documentation on the timetable object. } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" } |
A normal settings
object looks like:
{ "is12HourMode": boolean, "isDarkMode": boolean, "isSquareEdges": boolean, "isHideFullClasses": boolean, "isDefaultUnscheduled": boolean, "isHideClassInfo": boolean, "isSortAlphabetic": boolean, "isShowOnlyOpenClasses": boolean, "isHideExamClasses": boolean, "isConvertToLocalTimezone": boolean }
A singular timetable
object looks like:
{ "timetableId": (randomly generated in backend) string that represents a particular timetable id. "selectedCourses": An array of selected courses and their metadata. "events": An array of event objects. Look below for a more detailed documentation on the event object. }
A singular event
object looks like:
{ "id": The frontend generated id for event. "name": The name given to the event by the user. "location": The location for the event as specified by the user. "description": The description of the event as specified by the user. "colour": The specified colour of the event }
/api/user/settings/:userId
Request type: GET
Description:
Return the user’s settings
Result
Code | Format |
---|---|
200 | { "status": "Successfully found user and their settings!", "data": { "is12HourMode": boolean "isDarkMode": boolean "isSquareEdges": boolean "isHideFullClasses": boolean "isDefaultUnscheduled": boolean "isHideClassInfo": boolean "isSortAlphabetic": boolean "isShowOnlyOpenClasses": boolean "isHideExamClasses": boolean "isConvertToLocalTimezone": boolean } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/user/settings
Request type: PUT
Description:
Edit User Settings.
Body Parameters
Name | Description |
---|---|
userId | The user’s google uid |
setting |
|
A setting
object looks like this:
{ "is12HourMode": boolean, "isDarkMode": boolean, "isSquareEdges": boolean, "isHideFullClasses": boolean, "isDefaultUnscheduled": boolean, "isHideClassInfo": boolean, "isSortAlphabetic": boolean, "isShowOnlyOpenClasses": boolean, "isHideExamClasses": boolean, "isConvertToLocalTimezone": boolean }
Result
Code | Format |
---|---|
200 | { "status": "Successfully edited user settings!", "data": { "is12HourMode": boolean "isDarkMode": boolean "isSquareEdges": boolean "isHideFullClasses": boolean "isDefaultUnscheduled": boolean "isHideClassInfo": boolean "isSortAlphabetic": boolean "isShowOnlyOpenClasses": boolean "isHideExamClasses": boolean "isConvertToLocalTimezone": boolean } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/user/timetable/:userId
Request type: GET
Description:
Return a list of a user’s timetables
Path Variables
Name | Description |
---|---|
userId | The ID of the user |
Result
Code | Format |
---|---|
200 | { "status": Success message for finding the user and their timetables. "data": An array of user timetables. } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/user/timetable
Request type: POST
Description:
Create a new timetable
Body Parameters
Name | Description |
---|---|
timetableId | This is just dummy data, let this be any valid string and the backend will generate a nice uuid for the timetable. |
selectedCourses | The user’s selected courses |
selectedClasses | The user’s selected classes |
createdEvents | The user’s created events |
Result
Code | Format |
---|---|
200 | { "status": "Successfully found user and created their new timetable!", "data": uuid of the newly created timetable. } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/user/timetable
Request type: PUT
Description
Edit an existing timetable
Body Parameters
Name | Description |
---|---|
userId | The ID of the user |
timetable |
|
Timetable
Name | Description |
---|---|
timetableId | The ID of the timetable |
selectedCourses | The user’s new selected courses |
selectedClasses | The user’s new selected classes |
createdEvents | The user’s new created events |
Result
Code | Format |
---|---|
200 | { "status": "Successfully Edited timetable", "data": { "id": The uuid of the timetable edited. } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "User Not Found!" |
/api/user/timetable
Request type: DELETE
Description
Delete a user’s timetable
Result
Code | Format |
---|---|
200 | { "status": Success message for finding the user and their timetables. "data": { "id": The id of the timetable deleted. } } |
404 | { "statusCode": 404. "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. eg "Timetable Not found!" or "User Not found!". |
Body Parameters
Name | Description |
---|---|
userId | The ID of the timetable |
timetableId | The ID of the timetable |
GROUPS
/api/group/:id
Request type: GET
Description
Get the information of a group given a group ID.
Code | Format |
---|---|
200 | { "status": Success message for creation of group. "data": { "id": The id of the group created. "name": The name of the group created. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } } |
404 | { "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Can't find group!. } |
Path Parameters
Name | Description |
---|---|
id | The ID of the group. |
/api/group
Request type: POST
Description
Create a new group.
Result
Code | Format |
---|---|
200 | { "status": Success message for creation of group. "data": { "id": The id of the group created. "name": The name of the group created. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } } |
201 | { "status": Group with that ID already exists! "data": { "id": The id of the group created. "name": The name of the group created. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } } |
400 | { "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. } |
Body Parameters
Name | Description |
---|---|
groupData | { "name": The name of the group. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } |
groupID | The ID of the group. |
/api/group
Request type: PUT
Description
Updates the information of a group given a group ID.
Result
Code | Format |
---|---|
200 | { "status": Success message for updating of group. "data": { "id": The id of the group created. "name": The name of the group created. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } } |
201 | { "status": Group created! "data": { "id": The id of the group created. "name": The name of the group created. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } } |
409 | { "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. ie already exists } |
Body Parameters
Name | Description |
---|---|
adminUserID | The ID of the admin wishing to make changes. |
groupData | { "name": The name of the group. "visibility": The group visibility, the default is private groups. "timetableIDs": The list of all the selected timetables for users in the group. "memberIDs": The list of all members in the group. "groupAdmins": The list of all the group admins. } |
groupID | The ID of the group. |
/api/group
Request type: DELETE
Description
Delete a group given the group ID.
Result
Code | Format |
---|---|
204 | { "status": Success message for deletion of group. "data": {} } |
404 | { "timestamp": An ISOString format timestamp of when error encountered. "path": The url path that cause this error to occur. "data": Message detailing what went wrong. ie Not Found, Or user is not authorized for the action. } |
Body Parameters
Name | Description |
---|---|
userID | The ID of the user wishing to delete group. |
groupID | The ID of the group. |
Add Comment