Server API
펫 관리 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)
# {"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);
// {data: {id: "pet-uuid-1234"}}요청 파라미터
| 필드 | 타입 | 필수 | 설명 |
|---|---|---|---|
species | string | ✅ | 종류: DOG 또는 CAT |
breed | string | ❌ | 품종 |
metadata | string | ❌ | JSON 문자열 형태의 추가 정보 |
응답
{
"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);응답
{
"data": {
"pets": [
{
"id": "pet-uuid-1234",
"species": "DOG",
"breed": "골든 리트리버",
"metadata": "{\"name\": \"버디\", \"age\": 3}",
"createdAt": "2026-01-15T10:30:00Z"
},
{
"id": "pet-uuid-5678",
"species": "CAT",
"breed": "러시안 블루",
"metadata": "{\"name\": \"나비\", \"age\": 2}",
"createdAt": "2026-01-10T14:20:00Z"
}
]
}
}펫 상세 조회
특정 반려동물의 상세 정보를 조회합니다.
엔드포인트: 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);응답
{
"data": {
"id": "pet-uuid-1234",
"species": "DOG",
"breed": "골든 리트리버",
"metadata": "{\"name\": \"버디\", \"age\": 3, \"owner\": \"홍길동\"}",
"fingerprintCount": 5,
"appearanceCount": 2,
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-01-16T09:15:00Z"
}
}펫 정보 수정
반려동물의 메타데이터를 수정합니다.
엔드포인트: 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);요청 파라미터
| 필드 | 타입 | 필수 | 설명 |
|---|---|---|---|
breed | string | ❌ | 품종 |
metadata | string | ❌ | JSON 문자열 형태의 추가 정보 |
응답
{
"data": {
"id": "pet-uuid-1234",
"species": "DOG",
"breed": "골든 리트리버 믹스",
"metadata": "{\"name\": \"버디\", \"age\": 4, \"owner\": \"홍길동\", \"vaccinated\": true}",
"updatedAt": "2026-01-19T11:00:00Z"
}
}펫 삭제
반려동물 프로필과 관련 생체 정보를 삭제합니다.
엔드포인트: 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 문자열로 저장되므로, 조회 시 파싱하여 사용하세요. 필드명과 구조는 비즈니스 요구사항에 맞게 자유롭게 정의할 수 있습니다.