Body Size Create

user pk, pet pk 값에 해당하는 펫의 신체 사이즈 객체를 생성합니다.

URL

/medical/<user_pk>/pets/<pet_pk>/sizes/

Method

POST

Headers Key Headers Value 설명 Required
Authorization Token 321*************************** 로그인에서 획득한 Token값 입력 True

Data Params

Key Description Value Type Required
goal_weight 목표 체중 소숫점이 포함된 실수(kg 단위라고 생각하시면 됩니다) Float True
current_weight 현재 체중 소숫점이 포함된 실수(위와 동일) Float True
chest 가슴 둘레 양의 정수(cm 단위) Positive Integer True
neck 목 둘레 양의 정수(위와 동일) Positive Integer True

Success Response

HTTP Status code

201 CREATED

Content

{
    "pk": 1, # 신체사이즈 고유의 pk '<body_pk>'
    "goal_weight": 5, # 목표 체중
    "current_weight": 6.6, # 현재 체중
    "chest": 70, # 가슴 둘레
    "neck": 50, # 목 둘레
    "created_date": "2017-12-26" # 생성 시기 (자동 생성)
}

Error Response

HTTP Status code 400

Content

# 필수 입력 값을 입력하지 않은 경우 / 올바른 숫자를 입력하지 않은 경우
{
    "goal_weight": [
        "A valid number is required."
    ],
    "current_weight": [
        "A valid number is required."
    ],
    "chest": [
        "A valid integer is required."
    ],
    "neck": [
        "A valid integer is required."
    ]
}

HTTP Status code 401 Unauthorized

Content

# 토큰을 전달하지 않은 경우(로그인하지 않은 유저의 접근)
{
    "detail": "Authentication credentials were not provided."
}
# 잘못된 토큰으로 접근한 경우(만료된 토큰, DB에 존재하지 않는 토큰)
{
    "detail": "Invalid token."
}

HTTP Status code 403 Forbidden

Content

# 다른 유저의 토큰으로 접근한 경우
{
    "detail": "You do not have permission to perform this action."
}

HTTP Status code

404 Not Found

# pk값이 올바르지 않게 입력된 경우
{
    "detail": "Not found."
}

results matching ""

    No results matching ""