Skip to content

API Specifications

YeonJeong edited this page Oct 4, 2023 · 28 revisions

API Specifications for SpeechBuddy


User

POST /user/signup/ (creates new user by signing up)

Request

Header
Key Value Description
None None N/A
Body
{
  "email": "string",
  "password": "string",
  "nickname": "string"
}

Response

Status Code
Code Message Description
201 None N/A
400 wrong input (one or more input fields are missing or given with the wrong type)
400 password unavailable (the length of the password doesn't meet the requirements)
400 email address unavailable (email address is already taken)
POST /user/login/ (creates new authorization tokens)

Request

Header
Key Value Description
None None N/A
Body
{
  "email": "string",
  "password": "string"
}

Response

Body
{
  "access": "string",
  "refresh": "string"
}
Status Code
Code Message Description
200 None OK
400 wrong email address (there is no user signed up with this email address)
400 wrong password (the password doesn't match that of the user with this email address)
POST /user/refresh/ (refreshes user's authorization tokens)

Request

Header
Key Value Description
None None N/A
Body
{
  "refresh": "string"
}

Response

Body
{
  "access": "string"
}
Status Code
Code Message Description
200 None OK
400 wrong input (one or more input fields are missing or given with the wrong type)
401 refresh token expired (refresh token expired; user has to attempt a new login)
POST /user/logout/ (deletes user's authorization tokens) 🔒

Request

Header
Key Value Description
Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')

Response

Status Code
Code Message Description
200 None OK
403 no access token (no access token was sent in the header)
403 access token expired (access token expired; user has to refresh to retrieve a new token)
GET /user/checkemail/ (checks for email address duplicates)

Request

Header
Key Value Description
None None N/A
Body
{
  "email": "string"
}

Response

Status Code
Code Message Description
200 None OK
400 wrong input (one or more input fields are missing or given with the wrong type)
400 email address unavailable (email address is already taken)
GET /user/profile (gets user's profile) 🔒

Request

Header
Key Value Description
Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')

Response

Body
{
  "user": {
    "email": "string",
    "nickname": "string",
    ... // more fields to be added later
  }
}
Status Code
Code Message Description
200 None OK
400 no access token (no access token was sent in the header)
401 access token expired (access token expired; user has to refresh to retrieve a new token)
POST /user/changepw/ (To be modified) # ### (changes password) 🔒

Request

Header
Key Value Description
Authorization Bearer {access} user's access token (must be sent with the prefix 'Bearer')
Body
{
  "password": "string"
}

Response

Status Code
Code Message Description
200 None OK
400 wrong input (one or more input fields are missing or given with the wrong type)
400 password unavailable (the length of the password doesn't meet the requirements)
400 no access token (no access token was sent in the header)
401 access token expired (access token expired; user has to refresh to retrieve a new token)

Symbol

Clone this wiki locally