!

Recipes

This page contains examples of common use cases for the Houski API.

You can copy and paste the code examples into your own application.

Programming language

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

Choose a recipe


Get properties around a point
This request returns properties within a 2km radius of the point (51.0447, -114.0719).
Request
Shell session
curl -X GET "https://api.houski.ca/geocoding?api_key=YOUR_API_KEY&latitude=51.0447&longitude=-114.0719&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('latitude', '51.0447');
    url.searchParams.set('longitude', '-114.0719');
    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": 4.800000190734863,
  "data": [
    {
      "address": "0 Calgary",
      "bathroom_full": 2,
      "bathroom_half": 2,
      "bedroom": 4,
      "den": 0,
      "latitude": 51.044734954833984,
      "longitude": -114.07188415527344,
      "property_id": "8a4f3aa57d75cc88"
    },
    {
      "address": "366 94 Avenue SE",
      "bathroom_full": 1,
      "bathroom_half": 0,
      "bedroom": 2,
      "den": 0,
      "latitude": 51.044734954833984,
      "longitude": -114.07188415527344,
      "property_id": "a5a3a5b87c6b5fe7"
    },
    {
      "address": "306 Aquila Way NW",
      "bathroom_full": 1,
      "bathroom_half": 1,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.044734954833984,
      "longitude": -114.07188415527344,
      "property_id": "c3c520c402fcd54e"
    },
    {
      "address": "513 9 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 0,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.0445442199707,
      "longitude": -114.07219696044922,
      "property_id": "e9baf46145362e25"
    },
    {
      "address": "520 9 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 0,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.04524612426758,
      "longitude": -114.07220458984376,
      "property_id": "8808ff7c79ba3508"
    },
    {
      "address": "525 8 Avenue SW",
      "bathroom_full": 2,
      "bathroom_half": 0,
      "bedroom": 3,
      "den": 0,
      "latitude": 51.04531478881836,
      "longitude": -114.0724105834961,
      "property_id": "301a806c3b139f6"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 8605
  },
  "price_quote": false,
  "result_total": 51628,
  "time_ms": 298
}