펫 관리 API
반려동물 프로필 생성, 조회, 수정, 삭제 API를 안내합니다.
개요
펫 관리 API를 통해 반려동물 프로필을 CRUD(생성, 조회, 수정, 삭제)할 수 있습니다.
펫 생성
새로운 반려동물 프로필을 생성합니다.
엔드포인트: POST /v2/pets
요청
curl -X POST "https://api.petify.petnow.io/v2/pets" \
-H "x-petnow-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"species": "DOG",
"breed": "골든 리트리버",
"metadata": "{\"name\": \"버디\", \"age\": 3, \"owner\": \"홍길동\"}"
}'import requests
import json
url = "https://api.petify.petnow.io/v2/pets"
headers = {
"x-petnow-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"species": "DOG",
"breed": "골든 리트리버",
"metadata": json.dumps({
"name": "버디",
"age": 3,
"owner": "홍길동"
})
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
# {"success": true, "data": {"id": "pet-uuid-1234"}}const response = await fetch("https://api.petify.petnow.io/v2/pets", {
method: "POST",
headers: {
"x-petnow-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
species: "DOG",
breed: "골든 리트리버",
metadata: JSON.stringify({
name: "버디",
age: 3,
owner: "홍길동"
})
})
});
const result = await response.json();
console.log(result);
// {success: true, data: {id: "pet-uuid-1234"}}요청 파라미터
| 필드 | 타입 | 필수 | 설명 |
|---|---|---|---|
species | string | ✅ | 종류: DOG 또는 CAT |
breed | string | ❌ | 품종 |
metadata | string | ❌ | JSON 문자열 형태의 추가 정보 |
응답
{
"success": true,
"data": {
"id": "pet-uuid-1234"
}
}메타데이터 활용: metadata 필드에 JSON 문자열로 이름, 나이, 소유자 정보 등 비즈니스에 필요한 추가 정보를 저장할 수 있습니다.
펫 목록 조회
등록된 모든 반려동물 목록을 조회합니다.
엔드포인트: GET /v2/pets
요청
curl -X GET "https://api.petify.petnow.io/v2/pets" \
-H "x-petnow-api-key: YOUR_API_KEY"import requests
url = "https://api.petify.petnow.io/v2/pets"
headers = {
"x-petnow-api-key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
result = response.json()
print(result)const response = await fetch("https://api.petify.petnow.io/v2/pets", {
method: "GET",
headers: {
"x-petnow-api-key": "YOUR_API_KEY"
}
});
const result = await response.json();
console.log(result);응답
{
"success": true,
"data": [
{
"id": "pet-uuid-1234",
"species": "DOG",
"breed": "골든 리트리버",
"metadata": "{\"name\": \"버디\", \"age\": 3}",
"hasFingerprint": true,
"createdAt": "2026-01-15T10:30:00Z"
},
{
"id": "pet-uuid-5678",
"species": "CAT",
"breed": "러시안 블루",
"metadata": "{\"name\": \"나비\", \"age\": 2}",
"hasFingerprint": false,
"createdAt": "2026-01-10T14:20:00Z"
}
]
}data는 pets 필드로 감싸지 않고 펫 배열을 직접 반환합니다. 각 항목에는 등록된 지문 보유 여부를 나타내는 hasFingerprint(boolean)가 포함됩니다.
펫 상세 조회
특정 반려동물의 상세 정보를 조회합니다.
엔드포인트: GET /v2/pets/{petId}
요청
curl -X GET "https://api.petify.petnow.io/v2/pets/pet-uuid-1234" \
-H "x-petnow-api-key: YOUR_API_KEY"import requests
pet_id = "pet-uuid-1234"
url = f"https://api.petify.petnow.io/v2/pets/{pet_id}"
headers = {
"x-petnow-api-key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
result = response.json()
print(result)const petId = "pet-uuid-1234";
const response = await fetch(`https://api.petify.petnow.io/v2/pets/${petId}`, {
method: "GET",
headers: {
"x-petnow-api-key": "YOUR_API_KEY"
}
});
const result = await response.json();
console.log(result);응답
{
"success": true,
"data": {
"id": "pet-uuid-1234",
"species": "DOG",
"breed": "골든 리트리버",
"metadata": "{\"name\": \"버디\", \"age\": 3, \"owner\": \"홍길동\"}",
"hasFingerprint": true,
"createdAt": "2026-01-15T10:30:00Z"
}
}응답 필드
| 필드 | 타입 | 설명 |
|---|---|---|
id | string | 펫 ID |
species | string | DOG 또는 CAT |
breed | string | 품종 |
metadata | string | JSON 문자열 형태의 추가 정보 |
hasFingerprint | boolean | 등록된 지문 보유 여부 |
createdAt | string | 생성 시각 (ISO 8601) |
펫 정보 수정
반려동물의 메타데이터를 수정합니다.
엔드포인트: PATCH /v2/pets/{petId}
요청
curl -X PATCH "https://api.petify.petnow.io/v2/pets/pet-uuid-1234" \
-H "x-petnow-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"breed": "골든 리트리버 믹스",
"metadata": "{\"name\": \"버디\", \"age\": 4, \"owner\": \"홍길동\", \"vaccinated\": true}"
}'import requests
import json
pet_id = "pet-uuid-1234"
url = f"https://api.petify.petnow.io/v2/pets/{pet_id}"
headers = {
"x-petnow-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"breed": "골든 리트리버 믹스",
"metadata": json.dumps({
"name": "버디",
"age": 4,
"owner": "홍길동",
"vaccinated": True
})
}
response = requests.patch(url, headers=headers, json=data)
result = response.json()
print(result)const petId = "pet-uuid-1234";
const response = await fetch(`https://api.petify.petnow.io/v2/pets/${petId}`, {
method: "PATCH",
headers: {
"x-petnow-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
breed: "골든 리트리버 믹스",
metadata: JSON.stringify({
name: "버디",
age: 4,
owner: "홍길동",
vaccinated: true
})
})
});
const result = await response.json();
console.log(result);요청 파라미터
| 필드 | 타입 | 필수 | 설명 |
|---|---|---|---|
metadata | string | ✅ | JSON 문자열 형태의 추가 정보 |
breed | string | ❌ | 품종 |
응답
{
"success": true,
"data": {
"isSuccessful": true
}
}수정 API는 { "isSuccessful": true }만 반환하며, 수정된 펫 객체를 되돌려주지 않습니다. 수정된 값이 필요하면 이후 펫 상세 조회를 호출하세요.
펫 삭제
반려동물 프로필과 관련 생체 정보를 삭제합니다.
엔드포인트: DELETE /v2/pets/{petId}
요청
curl -X DELETE "https://api.petify.petnow.io/v2/pets/pet-uuid-1234" \
-H "x-petnow-api-key: YOUR_API_KEY"import requests
pet_id = "pet-uuid-1234"
url = f"https://api.petify.petnow.io/v2/pets/{pet_id}"
headers = {
"x-petnow-api-key": "YOUR_API_KEY"
}
response = requests.delete(url, headers=headers)
print(response.status_code) # 204 No Contentconst petId = "pet-uuid-1234";
const response = await fetch(`https://api.petify.petnow.io/v2/pets/${petId}`, {
method: "DELETE",
headers: {
"x-petnow-api-key": "YOUR_API_KEY"
}
});
console.log(response.status); // 204 No Content응답
성공 시 204 No Content를 반환합니다.
주의: 펫을 삭제하면 등록된 모든 지문과 외관 이미지도 함께 삭제됩니다. 이 작업은 되돌릴 수 없습니다.
메타데이터 스키마 예시
metadata 필드에 저장할 정보의 예시입니다:
{
"name": "버디",
"age": 3,
"gender": "male",
"owner": {
"name": "홍길동",
"phone": "010-1234-5678",
"email": "user@example.com"
},
"vaccinated": true,
"registrationNumber": "123456789",
"notes": "알러지 있음"
}팁: 메타데이터는 JSON 문자열로 저장되므로, 조회 시 파싱하여 사용하세요. 필드명과 구조는 비즈니스 요구사항에 맞게 자유롭게 정의할 수 있습니다.