!

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 the age demographics of the people near a property
In this example, we are retrieving detailed age demographics of the population living near a property in Edmonton, Alberta, Canada.
Request
Shell session
curl -X GET "https://api.houski.ca/properties?api_key=YOUR_API_KEY&city=edmonton&country_abbreviation=ca&province_abbreviation=ab&results_per_page=1&select=demographic_age_0_to_4_years_percent,demographic_age_5_to_9_years_percent,demographic_age_10_to_14_years_percent,demographic_age_15_to_19_years_percent,demographic_age_20_to_24_years_percent,demographic_age_25_to_29_years_percent,demographic_age_30_to_34_years_percent,demographic_age_35_to_39_years_percent,demographic_age_40_to_44_years_percent,demographic_age_45_to_49_years_percent,demographic_age_50_to_54_years_percent,demographic_age_55_to_59_years_percent,demographic_age_60_to_64_years_percent,demographic_age_65_to_69_years_percent,demographic_age_70_to_74_years_percent,demographic_age_75_to_79_years_percent,demographic_age_80_to_84_years_percent,demographic_age_85_to_89_years_percent,demographic_age_90_to_94_years_percent,demographic_age_95_to_99_years_percent,demographic_age_100_years_and_over_percent"
TypeScript code
const houski_recipe_data = async (): Promise<PropertiesResponse> => {

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

    const url = new URL('https://api.houski.ca/properties');
    url.searchParams.set('api_key', 'YOUR_API_KEY');
    url.searchParams.set('city', 'edmonton');
    url.searchParams.set('country_abbreviation', 'ca');
    url.searchParams.set('province_abbreviation', 'ab');
    url.searchParams.set('results_per_page', '1');
    url.searchParams.set('select', 'demographic_age_0_to_4_years_percent,demographic_age_5_to_9_years_percent,demographic_age_10_to_14_years_percent,demographic_age_15_to_19_years_percent,demographic_age_20_to_24_years_percent,demographic_age_25_to_29_years_percent,demographic_age_30_to_34_years_percent,demographic_age_35_to_39_years_percent,demographic_age_40_to_44_years_percent,demographic_age_45_to_49_years_percent,demographic_age_50_to_54_years_percent,demographic_age_55_to_59_years_percent,demographic_age_60_to_64_years_percent,demographic_age_65_to_69_years_percent,demographic_age_70_to_74_years_percent,demographic_age_75_to_79_years_percent,demographic_age_80_to_84_years_percent,demographic_age_85_to_89_years_percent,demographic_age_90_to_94_years_percent,demographic_age_95_to_99_years_percent,demographic_age_100_years_and_over_percent');

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

    return data;
}

(async () => {
let data: PropertiesResponse = await houski_recipe_data();

// Log the response
console.log(data);
})();
Response
JSON
{
  "cache_hit": false,
  "cost_cents": 2.299999952316284,
  "data": [
    {
      "address": "433 1818 Rutherford Road SW",
      "demographic_age_0_to_4_years_percent": 0.060747548937797546,
      "demographic_age_100_years_and_over_percent": 0.00021762677351944149,
      "demographic_age_10_to_14_years_percent": 0.05910050868988037,
      "demographic_age_15_to_19_years_percent": 0.05376865342259407,
      "demographic_age_20_to_24_years_percent": 0.06647014617919922,
      "demographic_age_25_to_29_years_percent": 0.07699041813611984,
      "demographic_age_30_to_34_years_percent": 0.08671437948942184,
      "demographic_age_35_to_39_years_percent": 0.0850525051355362,
      "demographic_age_40_to_44_years_percent": 0.07318689674139023,
      "demographic_age_45_to_49_years_percent": 0.06317606568336487,
      "demographic_age_50_to_54_years_percent": 0.05856138840317726,
      "demographic_age_55_to_59_years_percent": 0.059535764157772064,
      "demographic_age_5_to_9_years_percent": 0.06227588281035423,
      "demographic_age_60_to_64_years_percent": 0.0574534684419632,
      "demographic_age_65_to_69_years_percent": 0.04700738564133644,
      "demographic_age_70_to_74_years_percent": 0.03461749479174614,
      "demographic_age_75_to_79_years_percent": 0.021975358948111538,
      "demographic_age_80_to_84_years_percent": 0.015698805451393127,
      "demographic_age_85_to_89_years_percent": 0.010673603974282742,
      "demographic_age_90_to_94_years_percent": 0.005292287562042475,
      "demographic_age_95_to_99_years_percent": 0.001483818981796503,
      "property_id": "10001f3bac65c527"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 503195
  },
  "price_quote": false,
  "result_total": 503195,
  "time_ms": 140,
  "ui_info": {
    "city": "Edmonton",
    "city_id": "ba0db02120e894c9",
    "city_link": "ca/ab/edmonton",
    "city_slug": "edmonton",
    "country": "Canada",
    "country_abbreviation": "CA",
    "country_abbreviation_id": "9ace2b6431b7f1be",
    "country_abbreviation_link": "ca",
    "country_slug": "canada",
    "province": "Alberta",
    "province_abbreviation": "AB",
    "province_abbreviation_id": "aae1f05a0f89d2c7",
    "province_abbreviation_link": "ca/ab",
    "province_slug": "alberta"
  }
}