Skip to content

API Specifications

YeonJeong edited this page Oct 6, 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 key of Message Description
201 None Successfully created
400 email missing input value, invalid email format, length error(✅len<=50), already taken
400 password missing input value, length error(✅len>=8)
400 nickname missing input value, length error(✅len<=15)
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 key of Message Description
200 None OK
400 email missing input value, invalid email format, no such user w/ the email
400 password missing input value, wrong password
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 key of Message Description
200 None OK
400 refresh missing input value
401 detail and code 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')
Body
{
  "refresh": "string"
}

Response

Status Code
Code key of Message Description
200 None OK
403 detail no access token was sent in the header
403 detail, code and messages access token expired; user has to refresh to retrieve a new token
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": {
    "id": int,
    "email": "string",
    "nickname": "string",
    "updated_at": timestamp
    ... // more fields to be added later
  }
}
Status Code
Code key of Message Description
200 None OK
403 detail no access token was sent in the header
403 detail, code and messages access token expired; user has to refresh to retrieve a new token
PATCH /user/profile/nickname/ (changes user's nickname) 🔒

Request

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

Response

Status Code
Code key of Message Description
200 None Successfully changed
400 nickname missing input value, empty value, length error(✅len<=15), same as the original nickname
PATCH /user/profile/password/ (changes user's 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 key of Message Description
200 None Successfully changed
400 password missing input value, empty value, length error(✅len>=8)

Symbol

Clone this wiki locally