Overview
The Adosa Real Estate website integrates with the eGO Real Estate API to fetch property listings, submit leads, and manage contact forms. The integration is built with robust error handling, automatic retries, and rate limit management.Core API Service
TheApiCore class in src/services/api/api.ts provides the foundation for all API communication.
Configuration
Retry Logic with Exponential Backoff
The API client implements automatic retry with exponential backoff to handle transient failures and rate limiting:- First retry: Wait 2 seconds
- Second retry: Wait 5 seconds
- Third retry: Wait 10 seconds
- After 3 retries: Throw error
ApiCore.request() Method
The core request method handles all API communication with automatic retry logic:The API endpoint path (e.g.,
/v1/Properties)Standard fetch options (headers, method, body, etc.)
Language code for the request. Supported values:
es-ES, en-GBAuthentication
Authentication uses theAuthorizationToken sent in both headers and URL parameters for maximum compatibility:
Rate Limiting (429 Handling)
The API implements automatic rate limit handling:429 Too Many Requests response is received:
- Wait for the exponential backoff delay
- Automatically retry the request
- Continue up to 3 retry attempts
- Log warnings for monitoring
Example: Fetching Properties
ThePropertyService uses ApiCore.request() to fetch property listings:
Response Structure
Array of property objects from the eGO API
Total number of properties available across all pages
Pagination Strategy
ThePropertyService.getAll() method implements intelligent pagination:
- 1.5 second delay between page requests to avoid rate limits
- Maximum of 10 pages (1000 properties) to prevent infinite loops
- Continues until all records are fetched or limit reached
Error Handling
The API client includes comprehensive error handling:Network Error Retries
Network errors (connection failures, timeouts) also trigger automatic retries:Build Safety Guard
ThePropertyService includes a critical safety check to prevent deploying empty sites:
API Endpoints Used
Properties Endpoint
PAG- Page number (1-based)NRE- Number of records per pageThumbnailSize- Image thumbnail size IDAuthorizationToken- API authentication tokenLanguage- Language code (es-ES, en-GB)
Lead Endpoint
Contact Endpoint
CORS Configuration
All requests use CORS mode:Access-Control-Allow-Origin headers.
Best Practices
- Always use ApiCore.request() - Don’t bypass the core API client
- Respect rate limits - Add delays between bulk requests
- Handle 429 responses - The retry logic handles this automatically
- Use language parameter - Pass correct language for multilingual content
- Monitor logs - Check console output for API warnings and errors
- Test error scenarios - Verify retry logic works as expected
Related Documentation
- Leads Management - Lead and contact form submission
- Environment Variables - API token configuration
- Property Service - Property data handling