Relation
로그인한 사용자를
from_user로 가지고, 입력한 pk를 가진 사용자를to_user로 갖는 UserRelation object를 생성합니다.
URL
/member/relation/
Method
POST
Header
| Key | Value |
|---|---|
| Authorization | Token (로그인 시켰을 때 받은 token) |
Data Params
| Key | Description | Type | Require |
|---|---|---|---|
| to_user | 어떤 유저를 following 할 것인지 해당 유저를 명시한다. | Integer | True |
Success Response
HTTP Status code201
Content
{
"from_user": 3, # 현재 로그인 되어있는 유저
"to_user": 2 # 지금부터 from_user가 following 하는 유저
}
Error response
Bad Request error
HTTP Status code400
Content
필수 값 누락
{
"to_user": [
"이 항목을 채워주십시오."
]
}
Bad Request error
HTTP Status code400
Content
이미 팔로우하고 있는 유저에 접근할 경우
{
"to_user": [
"이미 팔로우 중입니다."
]
}
Bad Request error
HTTP Status code400
Content
# 본인 pk 로 접근
{
"to_user": [
"본인은 팔로우 할 수 없습니다."
]
}
Unauthorize error
HTTP Status code401
Content
# login 되지 않은 상태로 접근
{
"detail": "자격 인증데이터(authentication credentials)가 제공되지 않았습니다."
}