跳至主要内容

update_user

需求描述

修改使用者資料的 API 可修改的欄位有: email password 皆為 Optional

Method

PATCH

Endpoint

  • /api/auth

Request Header

{
"Authorization": "Bearer {token}"
}

Request Body

{
"email": "string",
"password": "string",
}

Response

修改成功

  • HTTP Status Code: 200
{
"email": "string",
"username": "string",
}

email 格式錯誤

  • HTTP Status Code: 422
{
"detail": [
{
"loc": [
"body",
"email"
],
"msg": "value is not a valid email address",
"type": "value_error.email"
}
]
}

密碼格式錯誤

  • HTTP Status Code: 422
{
"detail": [
{
"loc": [
"body",
"password"
],
"msg": "string does not match regex \"^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+]).{8,}$\"",
"type": "value_error.str.regex",
"ctx": {
"pattern": "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+]).{8,}$"
}
}
]
}

密碼輸入空字串

  • HTTP Status Code: 422
{
"detail": [
{
"ctx": {
"limit_value": 1
},
"loc": [
"body",
"password"
],
"msg": "ensure this value has at least 1 characters",
"type": "value_error.any_str.min_length"
}
]
}

使用用過的 email

  • HTTP Status Code: 400
{
"detail": "Email already in use"
}