/
❄️API Design

❄️API Design

TODO: Finish ERD & Swagger file

ERD:

 

Routes:

Onboarding:

POST - /user

Request body:

{

zid: string

}

 

200 Response:

{

status: “Success”

user: {

reviews: [],

bookmarked_reviews: [],

bookmarked_courses: [],

is_admin: false,

}

}

 

Login

GET - /user/${zid}

200 Response:

{

status: “Success”

user: {

reviews: [],

bookmarked_reviews: [],

bookmarked_courses: [],

is_admin: BOOLEAN,

}

}

 

Courses

GET - /courses

200 Response:

{

status: “Success”

courses: [{

reviews: [],

bookmarked_reviews: [],

bookmarked_courses: [],

is_admin: BOOLEAN,

}]

}

 

PUT - /courses/${course_id}

Request body:

{

…course object

}

200 Response:

{

status: “Success”

course: {}

}

 

POST - /courses/bookmark

Request body:

{

course_code: string;

zid: string;

bookmark: BOOLEAN;

}

200 Response:

{

status: “Success”

course: {}

}

 

Reviews

POST - /reviews

Request body: {

!timestamps, reports or review_id, upvotes

}

200 Response:

{

status: “Success”

review: {}

}

 

GET - /reviews

200 Response:

{

status: “Success”

reviews: [{}]

}

 

PUT - /reviews/${review_id}

Request body: {

!timestamps, reports or review_id, course_code, upvotes

}

200 Response:

{

status: “Success”

review: {}

}

 

DELETE - /reviews/${review_id}

200 Response:

{

status: “Success”

}

 

POST - /upvote/${review_id}

Request body: {

upvote: boolean

}

200 Response:

{

status: “Success”

upvotes: NUMBER

}

 

POST - /reviews/bookmark

Request body:

{

review_id: string;

zid: string;

bookmark: BOOLEAN;

}

200 Response:

{

status: “Success”

review: {}

}

 

Reports

POST - /reports

Request body: {

review_id: string,

zid: string,

reason: string,

}

200 Response:

{

status: “Success”

report: report_obj{}

}

 

PUT - /reports

Request body: {

report_id: string;

status: enum;

}

200 Response:

{

status: “Success”

report: report_obj{}

}

 

Users

PUT - /user/${zid}

Request body: {

admin: BOOLEAN;

}

200 Response:

{

status: “Success”

user: {}

}

Related content

UNSW CSESoc