AnswerUpVoteRelation Create
"질문 추천"
로그인한 사용자를
user
로 가지고, Client에서 보낸 데이터의 pk에 해당하는 질문을answer
로 가지는 AnswerUpVoteRelation(유저-질문 추천 관계) object을 생성합니다.
URL
/user/answer-upvote-relation/
Method
POST
Header
Key | Value |
---|---|
Authorization | Token(로그인 성공했을 때 받은 Token key값) |
Data Params
Key | Description | Type | Require |
---|---|---|---|
answer | 추천할 질문의 pk (primary key) 값 |
Integer | True |
Success Response
201 Created
HTTP Status Code
201
Content
{
# 생성한 AnswerUpVoteRelation object의 pk
# 추천을 취소할 때, 해당 pk를 URI에 담아서 DELETE 요청을 보내야 함
"follow_relation_pk": 3,
"user": 3,
"answer": 1
}
Error Response
Bad Request Error
HTTP Status Code
400
Content
# 필수 항목 누락
{
"answer": [
"이 필드는 필수 항목입니다."
]
}
Bad Request Error
HTTP Status Code
400
Content
# 존재하지 않는 질문을 추천하려한 경우
{
"answer": [
"유효하지 않은 pk \"2\" - 객체가 존재하지 않습니다."
]
}
Bad Request Error
HTTP Status Code
400
Content
# 이미 추천한 답변을 추천하려 한 경우
{
"answer": [
"이미 추천한 답변입니다."
]
}
Unauthorized Error
HTTP Status Code
401
Content
# 유저 Token을 헤더에 담지 않고 요청을 보낸 경우
{
"detail": "자격 인증데이터(authentication credentials)가 제공되지 않았습니다."
}
Unauthorized Error
HTTP Status Code
401
Content
# 존재하지 않는 유저 Token을 헤더에 담아 요청을 보낸 경우
{
"detail": "토큰이 유효하지 않습니다."
}