Question Create

Question Object를 생성합니다.

URL

/post/question/

Method

POST

URL Params

Key Description Type Require
content 질문 내용 String True
topics 토픽 pk Integer True

Seccess Response

HTTP Status Code

201

content

Key Description Type
pk Question pk Integer
user User pk Integer
content 작성한 String 데이터 String
created_at 생성된 날짜 Date
modified_at 수정된 날짜 Date
topics 생성된 질문 속하는 topics Integer
{
    "question": {
        "pk": 10,
        "user": 1,
        "content": "대통령 선거날짜가 내일인가요?",
        "created_at": "2017-12-13",
        "modified_at": "2017-12-13T09:11:35.700540+09:00"
    },
    "topics": [
        1,
        2
    ]
}

Error Response

HTTP Status code

400

Content

필수 필드를 비웠을 경우

{
    "topics": [
        "이 리스트는 비워 둘 수 없습니다."
    ],
    "content": [
        "이 필드는 blank일 수 없습니다."
    ]
}

HTTP Status code

400

Content

topics에 유효한 값을 넣지 않았을 때

{
    "topics": [
        "잘못된 형식입니다. pk 값 대신 str를 받았습니다."
    ]
}

HTTP Status code

400

Content

content에 10자 이상 입력하지 않았을 때

{
    "non_field_errors": [
        "질문이 너무 짧습니다. 10자 이상 작성해주세요."
    ]
}

results matching ""

    No results matching ""