Overview
Breeze integrates with the Google Pollen API to provide detailed pollen information including specific plant types, pollen levels, and personalized health recommendations. The API is accessed through a backend proxy to securely manage API credentials.Base URL
Breeze uses a backend proxy at
breeze.earth rather than calling the Google Pollen API directly. This approach keeps the Google API key secure and allows for rate limiting and caching.Endpoints Used
Get Pollen Data for Location
Fetches current pollen information for specific coordinates. Query Parameters:
Example Request:
Response Format
The API returns a comprehensive pollen forecast with two main data types:1. Pollen Type Information
General pollen categories (Grass, Tree, Weed):2. Plant-Specific Information
Detailed data for specific plant species:Response Models
Breeze decodes the response into these Swift models:Usage Example
Here’s how Breeze fetches pollen data:Pollen Level Scale
Breeze interprets pollen index values on a 0-5 scale:Data Processing
Breeze consolidates pollen data into a unifiedPollenItem model that distinguishes between:
- General Pollen Types: Grass, Tree, Weed (
isPlant: false) - Specific Plants: Oak, Birch, Ragweed, etc. (
isPlant: true)
- Botanical family
- Peak season information
- Visual appearance description
- Plant images (when available)
Health Recommendations
The API provides actionable health recommendations based on pollen levels:- Outdoor activity suggestions
- Window management advice
- Medication reminders
- Air purifier usage recommendations
- Peak hour avoidance strategies
Backend Proxy Architecture
- Secure API key management
- Request caching for improved performance
- Rate limiting protection
- Consistent error handling
Error Handling
The service handles several error cases:- Invalid coordinates: Throws
URLError(.badURL) - Network issues: Propagates URLSession errors
- Bad response: Throws
URLError(.badServerResponse) - Missing data: Returns empty array when no pollen info available
Reference
- Google Pollen API Documentation
- Service Implementation:
BreezeApp/Services/PollenService.swift - Data Models:
BreezeApp/Models/PollenData.swift - Backend Proxy:
https://breeze.earth/api/pollen