UserFollowRelation Create

"타겟유저 팔로우"

로그인한 사용자를 user로 가지고, Client에서 보낸 데이터의 pk에 해당하는 유저를 target으로 가지는 UserFollowRelation(팔로우유저-타겟유저 팔로우 관계) object을 생성합니다.

URL

/user/user-follow-relation/

Method

POST

Header

Key Value
Authorization Token(로그인 성공했을 때 받은 Token key값)

Data Params

Key Description Type Require
target 팔로우할 유저의 pk(primary key) 값 Integer True

Success Response

201 Created

HTTP Status Code

201

Content

{
    # 생성한 UserFollowRelation object의 pk
    # 언팔로우를 할 때, 해당 pk를 URI에 담아서 DELETE 요청을 보내야 함 
    "follow_relation_pk": 25,
    # 팔로우하는 유저
    "user": 1,
    # 팔로우받는 유저
    "target": 2
}

Error Response

Bad Request Error

HTTP Status Code

400

Content

# 필수 항목 누락
{
    "target": [
        "이 필드는 필수 항목입니다."
    ]
}

Bad Request Error

HTTP Status Code

400

Content

# 존재하지 않는 유저를 팔로우하려한 경우
{
    "target": [
        "유효하지 않은 pk \"2\" - 객체가 존재하지 않습니다."
    ]
}

Bad Request Error

HTTP Status Code

400

Content

# 필수 항목 누락
{
"target": [
"자기 자신을 팔로우할 수 없습니다."
]
}

Bad Request Error

HTTP Status Code

400

Content

# 이미 팔로우한 유저를 팔로우하려 한 경우
{
    "target": [
        "이미 팔로우하고 있는 유저입니다."
    ]
}

Unauthorized Error

HTTP Status Code

401

Content

# 유저 Token을 헤더에 담지 않고 요청을 보낸 경우

{
    "detail": "자격 인증데이터(authentication credentials)가 제공되지 않았습니다."
}

Unauthorized Error

HTTP Status Code

401

Content

# 존재하지 않는 유저 Token을 헤더에 담아 요청을 보낸 경우

{
    "detail": "토큰이 유효하지 않습니다."
}

results matching ""

    No results matching ""