!

API recipes

Practical examples for using the Houski API.

Examples

Get age demographics for properties

Programming language

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

Get the age demographics of the people around a property
Pull age demographics for the population around an Edmonton property. See the Fields page for all demographic fields.
Request
Shell session
curl -X GET "https://api.houski.ca/properties?api_key=YOUR_API_KEY&city=edmonton&country_abbreviation=ca&page=1&property_type_eq=House&province_abbreviation=ab&results_per_page=1&select=address,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"
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('page', '1');
    url.searchParams.set('property_type_eq', 'House');
    url.searchParams.set('province_abbreviation', 'ab');
    url.searchParams.set('results_per_page', '1');
    url.searchParams.set('select', 'address,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');

    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": 0.41999998688697815,
  "data": [
    {
      "address": "12819 121 Avenue NW",
      "demographic_age_0_to_4_years_percent": 0.03703703731298447,
      "demographic_age_10_to_14_years_percent": 0.04938271641731262,
      "demographic_age_15_to_19_years_percent": 0.04938271641731262,
      "demographic_age_5_to_9_years_percent": 0.04938271641731262,
      "property_id": "1000286b73c1dbe3"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 328791
  },
  "price_quote": false,
  "result_total": 328791,
  "time_ms": 69,
  "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"
  }
}