-
Notifications
You must be signed in to change notification settings - Fork 2
API Specifications
YeonJeong Kim edited this page Dec 10, 2023
·
28 revisions
Template adopted from: https://gist.github.com/azagniotov/a4b16faf0febd12efbc6c3d7370383a6
POST /user/signup/ (creates new user by signing up)
Key Value Description None None N/A
{ "email": "string", "password": "string", "nickname": "string" }
Code key of Message Description 201None Successfully created 400missing input value, blank input, invalid email format, length error(✅len<=50) 400already_takenemail is already taken by another user 400passwordmissing input value, blank input 400short_pwshort password length(✅len>=8) 400nicknamemissing input value, blank input, length error(✅len<=15)
POST /user/validateemail/signup/send/ (sends verification code for signup via email)
Key Value Description None None N/A
{ "email": "string" }
Code key of Message Description 200None N/A (successfully sent) 400missing input value, blank input, invalid email format, length error(✅len<=50) 400already_takenemail is already taken by another user
POST /user/validateemail/pw/send/ (sends verification code for forgot-pw via email)
Key Value Description None None N/A
{ "email": "string" }
Code key of Message Description 200None N/A (successfully sent) 400missing input value, blank input, invalid email format, length error(✅len<=50) 400no_userno such user w/ the email
POST /user/validateemail/signup/accept/ (checks email verification code for signup)
Key Value Description None None N/A
{ "email": "string", // should be automatically set by frontend! not by a user! "code": "string" }
Code key of Message Description 200None N/A (successfully checked) 400missing input value, blank input, invalid email format, length error(✅len<=50) 400codemissing input value, blank input, length error(✅len==6) 400failwrong code
POST /user/validateemail/pw/accept/ (checks email verification code for forgot-pw)
Key Value Description None None N/A
{ "email": "string", // should be automatically set by frontend! not by a user! "code": "string" }
{ "access": "string" }
Code key of Message Description 200None N/A (successfully checked) 400missing input value, blank input, invalid email format, length error(✅len<=50) 400codemissing input value, blank input, length error(✅len==6) 400failwrong code
POST /user/login/ (creates new authorization tokens)
Key Value Description None None N/A
{ "email": "string", "password": "string" }
{ "access": "string", "refresh": "string" }
Code key of Message Description 200None OK 400missing input value, blank input, invalid email format 400wrong_emailno such user w/ the email 400passwordmissing input value, blank input 400wrong_passwordwrong password for the email
POST /user/refresh/ (refreshes user's authorization tokens)
Key Value Description None None N/A
{ "refresh": "string" }
{ "access": "string" }
Code key of Message Description 200None OK 400refreshmissing input value, blank input 401detailandcoderefresh token expired; user has to attempt a new login
POST /user/logout/ (deletes user's authorization tokens) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "refresh": "string" }
Code key of Message Description 200None OK 400refreshmissing input value, blank input 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
GET /user/profile/ (gets user's profile) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "id": int, "email": "string", "nickname": "string" }
Code key of Message Description 200None OK 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
PATCH /user/profile/nickname/ (changes user's nickname) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "nickname": "string" }
Code key of Message Description 200None Successfully changed 400nicknamemissing input value, blank input, length error(✅len<=15) 400samesame as the original nickname
PATCH /user/profile/password/ (changes user's password) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "password": "string" }
Code key of Message Description 200None Successfully changed 400passwordmissing input value, blank input, length error(✅len>=8) 400short_pwshort password length(✅len>=8)
POST /user/withdraw/ (deletes user's account) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "refresh": "string" // to be revoked }
Code key of Message Description 200None OK (successfully deleted) 400refreshmissing input value, blank input 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
POST /symbol/favorite/backup/ (backup user's favorite symbols) 🔒
name Type Datatype Description id optional string favorite symbol ids
e.g. /symbol/favorite/backup/?id=18,1,2
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
Since multiple parameters can be passed, "message" field is also a list when id raises an error
Code key of Message Description 200None OK 400idmissing input value, blank input, no such symbol 400not_minethe requested symbol is created by another user 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
GET /symbol/favorite/backup/ (get user's favorite symbols) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "results": [ { "id": int // symbol id }, { "id": int }... ] }
Code key of Message Description 200None OK 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
POST /symbol/backup/ (backup user's symbol) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
multipart/form-data "text" : string "category" : int "image" : image file
{ "id": int // symbol id }
Code key of Message Description 200None OK 400textmissing input value, blank input 400long_textword text is too long 400categorymissing input value, blank input, invalid category 400imagemissing input value 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
GET /symbol/ (get all of the user's valid custom symbols) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "my_symbols": [ { "id": int, "text": string, "category": int, "image": string(image url), "created_at": string(datetime) }, { "id": int, "text": string, "category": int, "image": string(image url), "created_at": string(datetime) }... ] }
Code key of Message Description 200None OK 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
GET /symbol/int:pk/ (get user's specific custom symbol) 🔒
pk is the symbol_id(int)
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "my_symbol": { "id": int, // same as the pk value "text": string, "category": int, "image": string(image url), "created_at": string(datetime) } }
Code key of Message Description 200None OK 400pkno such symbol 400not_minethe requested symbol is created by another user 400invalidthe symbol is not valid yet(is_valid==False) 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
POST /symbol/enable/ (backup user's custom symbols list(validate and delete)) 🔒
name Type Datatype Description id optional string custom symbol ids
e.g. /symbol/enable/?id=18,1,2
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
Since multiple parameters can be passed, "message" field is also a list when id raises an error
Code key of Message Description 200None OK 400idmissing input value, blank input, no such symbol, default symbol 400not_minethe requested symbol is created by another user 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
POST /setting/backup/ (backup user's setting) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "display_mode": int, "default_menu": int, "auto_backup": int }
Code key of Message Description 200None OK 400display_modemissing input value, blank input, invalid mode 400default_menumissing input value, blank input, invalid menu 400auto_backupmissing input value, blank input, invalid auto_backup 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
GET /setting/backup/ (get user's setting) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "display_mode": int, "default_menu": int, "auto_backup" : int, "updated_at" : string(%Y-%m-%d) }
Code key of Message Description 200None OK 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
POST /weight/backup/ (backup user's weight table) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "weight_table": [ { "id": int // symbol id "weight": string!!!! not a list!!! }, { "id": int "weight": string }... ] }
Code key of Message Description 200None OK 400idmissing input value, blank input, no such symbol 400not_minethe requested symbol is created by another user 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token
GET /weight/backup/ (get user's weight table) 🔒
Key Value Description Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
{ "weight_table": [ { "id": int // symbol id "weight": string!!!! not a list!!! }, { "id": int "weight": string }... ] }
Code key of Message Description 200None OK 403detailno access token was sent in the header 403detail,codeandmessagesaccess token expired; user has to refresh to retrieve a new token