Web service for Private-Teacher project. Written by Flask (Python)
/api/login
(Guest) - POST
- Login
- Params:
username
,password
/api/logout
(Admin, Member) - GET
- Logout
/api/users
(Admin) - GET
- View the users table
- Params:
limit
: Limit the number of recordsid
,name
,image
,phone
,email
priviledge
:Admin
orMember
/api/users/<int:user_id>
(Admin, Member) - GET
- View user by ID. Member can only view their own profile
/api/users/add
(Admin, Guest) - POST
- Add new user or register
- Params:
name
,email
,password
,image
,phone
,priviledge
/api/users/update/<int:user_id>
(Admin, Member) - PUT
- Update the profile of user by ID. Member can only update their own profile
- Params:
name
,email
,password
,image
,phone
,priviledge
/api/users/delete/<int:user_id>
(Admin) - DELETE
- Delete the profile of user by ID
/api/students/list
(All) - GET
- View the students table
- Params:
id
,name
,email
,phone
,image
price_per_hour
: The price that the student expects to pay his or her teacherschool
: The school of the studentlevel
: The current level of the studentuser_id
: The ID of the user who creates this student profilelocation
: The location of the studentlimit
: Limit the number of records
/api/students/<int:student_id>
(All) - GET
- View the student by ID
/api/students/add
(Admin, Member) - POST
- Add new student profile
- Params:
name
,email
,phone
,image
price_per_hour
: The price that the student expects to pay his or her teacherschool
: The school of the studentlevel
: The current level of the studentuser_id
: The ID of the user who creates this student profiledescription
: What the student wants to say about him or herlocation
: The location of the student
/api/students/update/<int:student_id>
(Admin, Member) - PUT
- Update the info of the student by student ID. Members can only update the student profiles that they create
- Params: The same params as
/api/students/add
/api/students/delete/<int:student_id>
(Admin, Member) - DELETE
- Delete the student profiles by student ID. Members can only delete their profiles
/api/teachers/list
(All) - GET
- View the teachers table
- Params:
id
,name
,email
,phone
,image
salary_per_hour
: The salary that the teacher expects to receive from his or her studentjob
: The current job of the teacherwork_place
: The current work place of the teacherlevel_to_teach
: The level of students whom the teacher expects to teachuser_id
: The ID of the user who creates this teacher profilelocation
: The location of the teacherlimit
: Limit the number of records
/api/teachers/<int:teacher_id>
(All) - GET
- View the teacher by ID
/api/teachers/add
(Admin, Member) - POST
- Add new teacher profile
- Params:
id
,name
,email
,phone
,image
salary_per_hour
: The salary that the teacher expects to receive from his or her studentjob
: The current job of the teacherwork_place
: The current work place of the teacherlevel_to_teach
: The level of students whom the teacher expects to teachuser_id
: The ID of the user who creates this teacher profiledescription
: What the teacher wants to say about him or herlocation
: The location of the teacherrating
: The average rating of the teacherrating_number
: The number of ratings that the teacher receiveslimit
: Limit the number of records
/api/teachers/update/<int:teacher_id>
(Admin, Member) - PUT
- Update the info of the teacher by teacher ID. Members can only update the teacher profiles that they create
- Params: The same params as
/api/teachers/add
/api/teachers/delete/<int:teacher_id>
(Admin) - DELETE
- Delete the teacher profiles by teacher ID. Members can only delete their profiles