Beginner 2-3 hours · 2 APIs
Build a Pet Adoption Finder
Find adoptable pets near your location with filtering by animal type, breed, and age. Connect with local shelters to find your perfect companion.
APIs Used
Data Flow
User Action
API Call
Transform
Output
How It Works
1
Detect the user's location automatically via IP Geolocation
2
User selects animal type (dog, cat, etc.) and optional breed/age filters
3
Search Petfinder for adoptable pets near the detected location
4
Display pet profiles with photos, descriptions, and shelter contact info
Code Outline
Pseudocode / JavaScript
// 1. Detect user location
const geoRes = await fetch('https://api.ipgeolocation.io/ipgeo?apiKey=YOUR_API_KEY');
const { city, state_prov, zipcode } = await geoRes.json();
// 2. Get Petfinder access token
const tokenRes = await fetch('https://api.petfinder.com/v2/oauth2/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
grant_type: 'client_credentials',
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET'
})
});
const { access_token } = await tokenRes.json();
// 3. Search for adoptable pets nearby
const petsRes = await fetch(
`https://api.petfinder.com/v2/animals?type=dog&location=${zipcode}&distance=25&limit=10`,
{ headers: { 'Authorization': `Bearer ${access_token}` } }
);
const { animals } = await petsRes.json();
// 4. Display pet profiles
console.log(`Adoptable dogs near ${city}, ${state_prov}:`);
animals.forEach(pet => {
console.log(`${pet.name} - ${pet.breeds.primary} | Age: ${pet.age}`);
console.log(` ${pet.description?.slice(0, 100) || 'No description'}...`);
console.log(` Shelter: ${pet.contact.email}`);
console.log(` Photo: ${pet.photos[0]?.medium || 'No photo'}\n`);
}); Recipe Details
Difficulty Beginner
Time 2-3 hours
APIs Used 2
Related Recipes
Related Tutorials
Note: These recipes are AI-generated suggestions based on API capabilities. Actual implementation may vary. Always refer to official API documentation for the latest specifications.