Pet Patch

user pk에 대응하는 유저가 pet pk에 대응하는 pet object를 수정합니다.

URL

/profile/<user_pk>/pets/<pet_pk>/

Method

PATCH

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

Input data

Key Description Value Type Required
name 펫 이름 String False
birth_date 생년월일 YYYY-MM-DD String False
gender 성별 male/female String False
body_color 개체 색깔 white/black/brown/gold String False
species 종류 PetSpecies object에서 정의된 PetSpecies 종류 문자열
(dog/cat)
String False
breeds 품종 PetBreeds object에서 정의된 PetBreed 종류 문자열
(시츄, 골든 리트리버, 코리안 숏헤어, 페르시안)
String False
identified_number 동물등록번호 String False
is_neutering 중성화 수술 여부 Boolean False
is_active 활성화 여부 Boolean default=True
image 프로필 이미지 jpg, jpeg, png, gif... Image File False

(펫 활성화 여부도 이곳에서 수정합니다) (바꾸고 싶은 필드의 payload 키 & 값만 입력하면 됩니다) (입력하지 않은 필드는 수정하지 않는 걸로 간주합니다)

Success Response

HTTP Status code

200

Content

{
    "owner": {
        "pk": 9,
        "user_type": "d",
        "email": "[email protected]",
        "nickname": "하하하",
        "is_active": true,
        "date_joined": "2017-11-28T20:42:48.208291+09:00"
    },
    "pet": {
        "pk": 126,
        "species": "강아지",
        "breeds": "골든 리트리버",
        "name": "냠냠이",
        "birth_date": "2015-01-01",
        "gender": "male",
        "body_color": "gold",
        "identified_number": "",
        "is_neutering": false,
        "is_active": true,
        "ages": "http://localhost:8000/profile/9/pets/126/age/"
        "image": "https://{domain}media/{파일명}.png"
    }
}

Error Response

HTTP Status code

400

Content

# 로그인하지 않은 유저가 접근했을 경우 (토큰이 없는 경우)
{
    "detail": "You do not have permission to perform this action."
}

HTTP Status code

401 Unauthorized

# 다른 유저가 접근했을 경우 (토큰이 일치하지 않는 경우)
{
    "detail": "Invalid token."
}

HTTP Status code**

413 Request Entity Too Large

Content

/*1MB 이상의 이미지가 업로드될 경우 */
<html>
<head>
<title>413 Request Entity Too Large</title>
</head>
<body bgcolor="white">
<center>
<h1>413 Request Entity Too Large</h1>
</center>
<hr>
<center>nginx/1.12.1</center>
</body>
</html>

results matching ""

    No results matching ""