Geo-Aware Property Search API
- API Integration
- REST API
- Unit Testing

| Platform | WordPress API |
|---|---|
| Services | Backend Development, QA automation |
| Tools | REST API, Postman |
Project Overview
A London based estate agent needed a fast, flexible property search their site could rely on across multiple front-end experiences (website, map search, marketing pages). I designed and built a WordPress REST API that supports rich filtering, geo-radius search, and distance-aware sorting, all backed by an automated test suite.
The Challenge
- Ship with clear documentation and automated tests the client can run.
- Query thousands of property records with sub-second responses.
- Allow radius search from a town while still returning town matches (address lines or town field).
- Support real-world filters: price ranges, bedrooms, age, type, status etc.
- Provide reliable pagination and stable ordering (by distance, price, or date).
Technical Approach
1) API Design
- Endpoint:
GET /wp-json/properties/v1/search - Clean REST args with defaults and sanitize callbacks (e.g.
absint,sanitize_key). - Predictable JSON envelope:
results,total,pages,current_page,response_time.
2) Location Logic
Many geo plugins add a SQL HAVING distance <= ... that can unintentionally exclude town or free typed location matches.
To guarantee correctness and speed, I used a two-pass union strategy:
- Town pass
Apply all non-location filters AND(town OR line1 OR line2 OR line3)→ collect IDs. - Geo pass
Apply all non-location filters AND geo radius (with distance) → collect IDs. - Union
Merge IDs from both passes. - Final query
Constrain bypost__inand order by distance using geo data without applying a distance filter ( so town matches remain ).
This delivers the intended (distance ≤ r) OR (address ≈ town) behavior with stable performance and correct pagination.
3) Filters & Sorting
Some of the filters required included;
- Bedrooms ≥ N, price min/max (auto-switches between
>=,<=, orBETWEEN). - Type rules that ground certain property type tags into selected options.
- Status constrained to safe sets with optional include of sold or let properties.
- Sorting:
- With radius:
distance→price/date - Without radius:
price_high,price_low,newest,oldest
- With radius:
Testing & Validation
I built a full Postman test suite covering functional and performance aspects of the API:
- Pagination tests
Verify total count, pages, and consistent ordering - Town vs. radius logic
Ensure towns appear even if just outside the radius - Filter validation
Bedrooms, price, and type combinations return correct subsets - Edge cases
radiuswithouttown(should ignore radius gracefully) - Performance checks
Response time logged and asserted to stay within acceptable limits
Each test runs automatically via Postman’s built-in test runner, giving the client confidence that future updates won’t break functionality.
Result
The new API reduced average search response times from several seconds to under 300 ms, enabling smooth integration across all front-end experiences.
It also provided a clean, documented and testable foundation for future development, turning a fragile legacy search into a robust, maintainable system.