- The Base URL: https://a-better-professor.herokuapp.com/
############################################################
- Note -- The professors and students have different endpoints to login, because the student array is a child of the professor array. Check your endpoints!
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
register professor (this is different from student registration) | POST | /api/auth/register |
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
lastname | string | yes | last name |
firstname | string | yes | first name |
username | string | yes | username (required for login, cannot be duplicate) |
password | string | yes | password (required for login) |
string | yes | email (cannot be duplicate) | |
role:admin | string | no | required to have admin privileges on site, but not required to create an account -- default is 'user' with no permissions |
-
-- Note - This is our default admin and has an account already set up for easy access - please use him to login, and you won't need to register!
{
"lastname":"Franklin", "firstname":"Ben", "username":"KiteGuy", "password":"Password1", "email": "pennysaved@email.com", "role": "admin", }
{
"token": "some garbled giant string of letters and numbers",
"message": "Welcome KiteGuy",
"id": 1,
"ETC"
}
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
login professor (this is different from student login) | POST | /api/login |
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
username | string | yes | username - must match registration |
password | string | yes | password - must match registration |
{
"token": "giant string of letters and numbers",
"message": "Welcome KiteGuy"
}
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
register student | POST | /api/auth/register/:id |
- -- Note -- it would be nice if the id you use here is the same as the professor id, but it's not necessary. Just use 1 if you don't want to think about it. Student reg and login also produce tokens.
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
lastname | string | yes | last name |
firstname | string | yes | first name |
username | string | yes | username (required for login, cannot be duplicate) |
password | string | yes | password (required for login) |
string | yes | email (cannot be duplicate) | |
professor_id | number | yes | required to add a student to a professor - if unsure, add to professor_id:1 |
{
"lastname":"Singer",
"firstname":"Aretha",
"username":"GoldenVoice",
"password":"password1",
"email": "sing@email.com",
"professor_id": 1
}
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
login student | POST | /api/auth/login/students |
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
username | string | yes | username - must match registration |
password | string | yes | password - must match registration |
professor_id | number | yes | professor the student belongs to, use 1, if you don't have/know one |
{
"username":"GoldenVoice",
"password":"password1",
"professor_id": 1
}
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
get a professor's students | GET | /api/user/:id/students |
get a professor's students, but fancy (nested under the professor -- looks a bit cleaner, yields the same result as the other GET) | GET | /api/users/all-students/:id |
get professor's messages | GET | /api/users/:id/messages |
add student | POST | api/users/:id/students |
add message | POST | /api/users/:id/messages |
update professor | PUT | /api/users/:id |
delete professor | DEL | /api/users/:id |
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
get all students in database (note -- will not use this, since professors can get their specific students) | GET | /api/students |
get all student by id | /api/students/:id | |
get student's tasks | GET | /api/students/:id/tasks |
get student's messages | GET | /api/students/:id/messages |
update student | PUT | /api/students/:id/ |
delete student | DEL | /api/students/:id/ |
add student (note -- this is restricted to admins only, only users can add students, we have this endpoint for reg/login purposes ) | POST | /api/students |
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
lastname | string | yes | last name |
firstname | string | yes | first name |
username | string | yes | username (required for login, cannot be duplicate) |
password | string | yes | password (required for login) |
string | yes | email (cannot be duplicate) | |
professor_id | number | yes | required to add a student to a professor - if unsure, add to professor_id:1 |
###Note -- in V1, we are not adding the ability for students to POST messages, they can only view their own messages.
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
get tasks | GET | /api/tasks |
get tasks by id | GET | /api/tasks/:id |
add task | POST | /api/tasks |
update tasks | PUT | /api/tasks/:id |
delete tasks | GET | /api/tasks/:id |
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
due_date | number | yes | Has to be added like this: "2020-09-09" |
task | string | yes | This is the task message, it can be very descriptive, no char limit |
professor_id | number | yes | Assigns student's task to a professor |
student_id | number | yes | Assigns task to a student |
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
get messages | GET | /api/messages |
get messages by id | GET | /api/messages/:id |
add message | POST | /api/messages |
update messages | PUT | /api/messages/:id |
delete messages | DEL | /api/messages/:id |
NAME | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
message | string | yes | send the message |
task_id | number | yes | assigns message to a task |
professor_id | number | yes | assigns message to professor's ID |
student_id | number | yes | assigns message to student's ID |
DESCRIPTION | TYPE | ENDPOINT |
---|---|---|
logout | GET | /api/auth/logout |