-
Notifications
You must be signed in to change notification settings - Fork 0
API Structure
The backend is accessible through a REST API, with responses provided in JSON format
/status (GET)
Get the list of supported schools
None
API Response Data
{
"status": string - "Alive" on success
}/users/{user} (GET)
Get a user by id
| Name | Location | Description |
|---|---|---|
| id | path | User's id |
On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"user": { - Payload, undefined on failure
"id": string, - Registered user's ID
"name": string, - Registered user's name
"school": string - Registered user's school's ID
}
}/users/{user}/courses (GET)
Get courses owned by a user
| Name | Location | Description |
|---|---|---|
| id | path | User's id |
On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"courses": [ - Payload, undefined on failure
{
"id": string, - ID of the course
"name": string, - Name of the course
"code": string, - Course code of the course
"year": int, - Academic year of the course
"term": string, - Term of the course
"prof": string, - Professor teaching the course
"owner": string, - ID of the user who maintains the course
"school": string, - ID of the course's school
"modified": long int - Unix timestamp the course or it's children were last modified
}
]
}/users/register (POST)
Register a new user
| Name | Location | Description |
|---|---|---|
| name | post | User's name |
| post | User's email | |
| password | post | User's password |
| school | post | ID of user's chosen school |
On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"user": { - Payload, undefined on failure
"id": string, - Registered user's ID
"name": string, - Registered user's name
"email": string, - Registered user's email
"school": string - Registered user's school's ID,
"token": string - Authentication token for the user's session
}
}/users/login (POST)
Log in to a user account
| Name | Location | Description |
|---|---|---|
| post | Email being used to log in | |
| password | post | Password being used to log in |
On success, returns information about logged in user. On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"user": { - Payload, undefined on failure
"id": string, - Registered user's ID
"name": string, - Registered user's name
"email": string, - Registered user's email
"school": string - Registered user's school's ID
"token": string - Authentication token for the user's session
}
}/users/subscriptions/get (GET)
Get courses subscribed to by a user, can be filtered by date modified
| Name | Location | Description |
|---|---|---|
| since | query | Timestamp to ignore courses modified before |
| token | cookie | Session token to get and authenticate user |
List of courses subscribed to by the user
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"courses": [ - Payload, undefined on failure
{
"id": string, - ID of the course
"name": string, - Name of the course
"code": string, - Course code of the course
"year": int, - Academic year of the course
"term": string, - Term of the course
"prof": string, - Professor teaching the course
"owner": string, - ID of the user who maintains the course
"school": string, - ID of the course's school
"modified": long int - Unix timestamp the course or it's children were last modified
}
]
}/users/subscriptions/add (POST)
Subscribe to a new course
| Name | Location | Description |
|---|---|---|
| course | post | ID of the course to subscribe to |
| token | cookie | Session token to get and authenticate user |
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"subscription": { - Payload, undefined on failure
"user": string, - ID of the user subscribing
"course": string - ID of the course subscribed to
}
}/users/subscriptions/{course}/remove (POST)
Unsubscribe from a course
| Name | Location | Description |
|---|---|---|
| course | path | ID of the course to unsubscribe from |
| token | cookie | Session token to get and authenticate user |
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string - Error message on failure, '' on success
}/users/todos/get (GET)
Get To-Dos for a user
| Name | Location | Description |
|---|---|---|
| token | cookie | Session token to authenticate user |
List of To-Dos for the user
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"todos": [ - Payload, undefined on failure
{
"id": string, - ID of the todo
"user": string, - ID of the todo's user
"name": string, - Name of the todo
"completed": boolean, - Todo completion flag
}
]
}/users/todos/add (POST)
Create a To-Do for a user
| Name | Location | Description |
|---|---|---|
| name | post | Name of To-Do |
| token | cookie | Session token to get and authenticate user |
On success, created To-Do. On failure error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"todo": { - Payload, undefined on failure
"id": string, - ID of the created todo
"user": string, - ID of the todo's user
"name": string, - Name of the created todo
"completed": boolean - Todo completion flag
}
}/users/todos/{todo}/modify (POST)
Modify a To-Do for a user
| Name | Location | Description |
|---|---|---|
| todo | path | ID of target To-Do |
| name | post | Name of To-Do |
| completed | post | Completion state of To-Do |
| token | cookie | Session token to get and authenticate user |
On success, updated To-Do. On failure error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"todo": { - Payload, undefined on failure
"id": string, - ID of the todo
"user": string, - ID of the todo's user
"name": string, - Updated name of the created todo
"completed": boolean - Updated todo completion flag
}
}/users/todos/{todo}/remove (POST)
Delete a To-Do for a user
| Name | Location | Description |
|---|---|---|
| todo | path | ID of the To-Do to delete |
| token | cookie | Session token to get and authenticate user |
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string - Error message on failure, '' on success
}/users/reminders/get (GET)
Get reminders for a user
| Name | Location | Description |
|---|---|---|
| token | cookie | Session token to get and authenticate user |
List of reminders for the user
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"reminders": [ - Payload, undefined on failure
{
"id": string, - ID of the reminder
"user": string, - ID of the reminder's user
"event": string - ID of the event the reminder is for
}
]
}/users/reminders/add (POST)
Create a reminder for a user
| Name | Location | Description |
|---|---|---|
| event | post | Event reminder is for |
| token | cookie | Session token to get and authenticate user |
On success, created reminder.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"reminder": { - Payload, undefined on failure
"id": string, - ID of the created reminder
"user": string, - ID of the reminder's user
"event": string - ID of the event the reminder is for
}
}/users/reminders/{reminder}/remove (POST)
Delete a reminder for a user
| Name | Location | Description |
|---|---|---|
| id | post | ID of the reminder to delete |
| token | cookie | Session token to get and authenticate user |
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string - Error message on failure, '' on success
}/schools/get (GET)
Get the list of supported schools
None
List of schools in database
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"schools": [ - Payload, undefined on failure
{
"id": string, - ID of school
"name": string, - Name of school
}
]
}/schools/{school}/courses/get (GET)
Get courses for a specific school, can also filter by year and term.
| Name | Location | Description |
|---|---|---|
| school | path | ID of school to get courses for |
| year | query | Year of returned courses |
| term | query | Term of returned courses |
List with all courses for specified school
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"courses": [ - Payload, undefined on failure
{
"id": string, - ID of the course
"name": string, - Name of the course
"code": string, - Course code of the course
"year": int, - Academic year of the course
"term": string, - Term of the course
"prof": string, - Professor teaching the course
"owner": string, - ID of the user who maintains the course
"school": string, - ID of the course's school
"modified": long int - Unix timestamp the course or it's children were last modified
}
]
}/courses/add (POST)
Create a new course
| Name | Location | Description |
|---|---|---|
| name | post | Name of course |
| code | post | Course code |
| year | post | Course's academic year |
| term | post | Course term, one of 'Wint', 'Spri', 'Summ', 'Fall' |
| prof | post | Course professor |
| owner | post | ID of user creating course |
| school | post | ID of course's school |
| token | cookie | Session token to authenticate user |
On success, returns information about created course. On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"course": { - Payload, undefined on failure
"id": string, - ID of the created course
"name": string, - Name of the course
"code": string, - Course code of the course
"year": int, - Academic year of the course
"term": string, - Term of the course
"prof": string, - Professor teaching the course
"owner": string, - ID of the user who maintains the course
"school": string, - ID of the course's school
"modified": long int - Unix timestamp the course or it's children were last modified
}
}/courses/{course}/modify (POST)
Modify an existing course
| Name | Location | Description |
|---|---|---|
| course | path | ID of target course |
| name | post | Name of course |
| code | post | Course code |
| year | post | Course's academic year |
| term | post | Course term, one of 'Wint', 'Spri', 'Summ', 'Fall' |
| prof | post | Course professor |
| school | post | ID of course's school |
| token | cookie | Session token to authenticate user |
On success, returns updated course. On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"course": { - Payload, undefined on failure
"id": string, - ID of the course
"name": string, - Updated name of the course
"code": string, - Updated course code
"year": int, - Updated academic year of the course
"term": string, - Updated term of the course
"prof": string, - Updated professor teaching the course
"owner": string, - ID of the user who maintains the course
"school": string, - Updated ID of the course's school
"modified": long int - Unix timestamp the course or it's children were last modified
}
}/courses/{course}/remove (POST)
Delete a existing course
| Name | Location | Description |
|---|---|---|
| course | path | ID of target course |
| token | cookie | Session token to authenticate user |
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
}/courses/{course}/events/get (GET)
Get events corresponding to a course
| Name | Location | Description |
|---|---|---|
| course | path | ID of target course |
List of events corresponding to the course
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"events": [ - Payload, undefined on failure
{
"id": string, - ID of the event
"course": string, - ID of the event's course
"name": string, - Name of the event
"type": string, - Type of event
"weight": int, - Grade weight of event
"datetime": long int, - Unix timestamp of event start
"endDate": long int, - Unix timestamp of event ending
"weekly": boolean - Flag to indicate if the event occurs each week
}
]
}/courses/{course}/events/add (POST)
Create an event for a course
| Name | Location | Description |
|---|---|---|
| course | path | ID of target course |
| name | post | Name of the event |
| type | post | Type of event, one of "LECTURE", "TUTORIAL", "LAB", "TEST", "QUIZ", or "ASSIGNMENT" |
weight |
post | Grade weight in course |
| datetime | post | Date/time of event, as unix timestamp |
| endDate | post | Date/time of event end, as unix timestamp or omitted for instantaneous events |
| weekly | post | True/False indicating if event should be repeated weekly |
| token | cookie | Session token to authenticate user |
On success, returns created event. On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"event": { - Payload, undefined on failure
"id": string, - ID of the created event
"course": string, - ID of the event's course
"name": string, - Name of the event
"type": string, - Type of event
"weight": int, - Grade weight of event
"datetime": long int, - Unix timestamp of event start
"endDate": long int, - Unix timestamp of event ending
"weekly": boolean - Flag to indicate if the event occurs each week
}
}/courses/{course}/events/{event}/modify (POST)
Modify an event for a course
| Name | Location | Description |
|---|---|---|
| course | path | ID of target course |
| event | path | ID of target event |
| name | post | Name of the event |
| type | post | Type of event, one of "LECTURE", "TUTORIAL", "LAB", "TEST", "QUIZ", or "ASSIGNMENT" |
weight |
post | Grade weight in course |
| datetime | post | Date/time of event, as unix timestamp |
| endDate | post | Date/time of event end, as unix timestamp or omitted for instantaneous events |
| weekly | post | True/False indicating if event should be repeated weekly |
| token | cookie | Session token to authenticate user |
On success, returns modified event. On failure, returns error message.
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string, - Error message on failure, '' on success
"event": { - Payload, undefined on failure
"id": string, - ID of the event
"course": string, - ID of the event's course
"name": string, - Updated name of the event
"type": string, - Updated type of event
"weight": int, - Updated grade weight of event
"datetime": long int, - Updated unix timestamp of event start
"endDate": long int, - Updated unix timestamp of event ending
"weekly": boolean - Updated flag to indicate if the event occurs each week
}
}/courses/{course}/events/{event}/remove (POST)
Delete and event from a course
| Name | Location | Description |
|---|---|---|
| course | path | ID of target course |
| event | path | ID of event to delete |
| token | cookie | Session token to authenticate user |
API Response Data
{
"success": bool, - True on success, otherwise false
"error": string - Error message on failure, '' on success
}