!

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 income demographics of the people near a property
In this example, we are retrieving the income demographics of the population around 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_income_under_10000_percent,demographic_income_10000_to_19999_percent,demographic_income_20000_to_29999_percent,demographic_income_30000_to_39999_percent,demographic_income_40000_to_49999_percent,demographic_income_50000_to_59999_percent,demographic_income_60000_to_69999_percent,demographic_income_70000_to_79999_percent,demographic_income_80000_to_89999_percent,demographic_income_90000_to_99999_percent,demographic_income_100000_to_149999_percent,demographic_income_150000_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_income_under_10000_percent,demographic_income_10000_to_19999_percent,demographic_income_20000_to_29999_percent,demographic_income_30000_to_39999_percent,demographic_income_40000_to_49999_percent,demographic_income_50000_to_59999_percent,demographic_income_60000_to_69999_percent,demographic_income_70000_to_79999_percent,demographic_income_80000_to_89999_percent,demographic_income_90000_to_99999_percent,demographic_income_100000_to_149999_percent,demographic_income_150000_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": 1.4000002145767212,
  "data": [
    {
      "address": "433 1818 Rutherford Road SW",
      "demographic_income_100000_to_149999_percent": 0.07744911313056946,
      "demographic_income_10000_to_19999_percent": 0.09204568713903429,
      "demographic_income_150000_and_over_percent": 0.044795382767915726,
      "demographic_income_20000_to_29999_percent": 0.14968667924404144,
      "demographic_income_30000_to_39999_percent": 0.13061492145061493,
      "demographic_income_40000_to_49999_percent": 0.11045818030834198,
      "demographic_income_50000_to_59999_percent": 0.09400448948144911,
      "demographic_income_60000_to_69999_percent": 0.07963474839925766,
      "demographic_income_70000_to_79999_percent": 0.06338218599557877,
      "demographic_income_80000_to_89999_percent": 0.04903702437877655,
      "demographic_income_90000_to_99999_percent": 0.04014365375041962,
      "demographic_income_under_10000_percent": 0.06874793022871017,
      "property_id": "10001f3bac65c527"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 503108
  },
  "price_quote": false,
  "result_total": 503108,
  "time_ms": 110,
  "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"
  }
}