API recipes

Requests you can copy and run. Each one returns live data from the API.

Examples

Climate and environment risk in a European city

Programming language

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

Climate and environment risk in a European city
Flood, fire, air quality, water quality and earthquake scores for Paris properties in one request. Every score runs from 0 to 10 and higher is better. A score compares places within one country, so read it against other places in the same country.
Request
Shell session
curl -X GET "https://api.houski.ca/properties?api_key=YOUR_API_KEY&city=paris&country_abbreviation=fr&page=1&province_abbreviation=idf&results_per_page=3&select=address,score_flood,score_fire,score_air_quality,score_water_quality,score_earthquake"
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', 'paris');
    url.searchParams.set('country_abbreviation', 'fr');
    url.searchParams.set('page', '1');
    url.searchParams.set('province_abbreviation', 'idf');
    url.searchParams.set('results_per_page', '3');
    url.searchParams.set('select', 'address,score_flood,score_fire,score_air_quality,score_water_quality,score_earthquake');

    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": true,
  "cost_cents": 1.56,
  "data": [
    {
      "address": "45 Rue Boissy Danglas",
      "property_id": "102fe80e4dba66e5",
      "score_air_quality": 5,
      "score_earthquake": 10,
      "score_fire": 8,
      "score_flood": 10,
      "score_water_quality": 5
    },
    {
      "address": "38 Avenue Gabriel",
      "property_id": "103bb779cd84a039",
      "score_air_quality": 5,
      "score_earthquake": 10,
      "score_fire": 8,
      "score_flood": 9,
      "score_water_quality": 5
    },
    {
      "address": "60 Rue Des Mathurins",
      "property_id": "10416bc994217b80",
      "score_air_quality": 5,
      "score_earthquake": 10,
      "score_fire": 8,
      "score_flood": 10,
      "score_water_quality": 5
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 21042
  },
  "price_quote": false,
  "result_total": 63126,
  "time_ms": 12,
  "ui_info": {
    "city": "Paris",
    "city_id": "22fbb45ffa18d682",
    "city_link": "fr/idf/paris",
    "city_slug": "paris",
    "country": "France",
    "country_abbreviation": "FR",
    "country_abbreviation_id": "ab154f820778087b",
    "country_abbreviation_link": "fr",
    "country_slug": "france",
    "province": "Île-de-France",
    "province_abbreviation": "IDF",
    "province_abbreviation_id": "75ea2c1d87abb735",
    "province_abbreviation_link": "fr/idf",
    "province_slug": "ile-de-france"
  }
}