!

API recipes

Practical examples for using the Houski API.

Examples

Find properties within radius of coordinates

Programming language

Select the programming language you want to display the code examples in.

Get properties around a point
Returns properties within a 2km radius of (51.0447, -114.0719).
Request
Shell session
curl -X GET "https://api.houski.ca/geocoding?api_key=YOUR_API_KEY&country_abbreviation=ca&latitude=51.0447&longitude=-114.0719&property_type_eq=House&radius=2&select=latitude,longitude,bedroom,den,bathroom_full,bathroom_half&shape=circle"
TypeScript code
const houski_geocoding = async (): Promise<GeocodingResponse> => {

    // You must copy the GeocodingResponse type declarations from the 
    // Houski API documentation to strongly type the response

    const url = new URL('https://api.houski.ca/geocoding');
    url.searchParams.set('api_key', 'YOUR_API_KEY');
    url.searchParams.set('country_abbreviation', 'ca');
    url.searchParams.set('latitude', '51.0447');
    url.searchParams.set('longitude', '-114.0719');
    url.searchParams.set('property_type_eq', 'House');
    url.searchParams.set('radius', '2');
    url.searchParams.set('select', 'latitude,longitude,bedroom,den,bathroom_full,bathroom_half');
    url.searchParams.set('shape', 'circle');

    const response = await fetch(url);
    const data = await response.json();

    return data;
}

(async () => {
let data: GeocodingResponse = await houski_geocoding();

// Log the response
console.log(data);
})();
Response
JSON
{
  "cache_hit": true,
  "cost_cents": 2.6399998664855957,
  "data": [
    {
      "address": "201 505 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.045658111572266,
      "longitude": -114.0718231201172,
      "property_id": "328ddfdcd712fa26"
    },
    {
      "address": "305 505 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.045658111572266,
      "longitude": -114.0718231201172,
      "property_id": "62614d31007508e9"
    },
    {
      "address": "200 505 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.045658111572266,
      "longitude": -114.0718231201172,
      "property_id": "736257e5099784e0"
    },
    {
      "address": "500 505 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.045658111572266,
      "longitude": -114.0718231201172,
      "property_id": "7ea72c951f47c018"
    },
    {
      "address": "310 505 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.045658111572266,
      "longitude": -114.0718231201172,
      "property_id": "905b5b3e094e0bc0"
    },
    {
      "address": "515 505 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.045658111572266,
      "longitude": -114.0718231201172,
      "property_id": "9412f76df2925649"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 3907
  },
  "price_quote": false,
  "result_total": 23441,
  "time_ms": 27
}