API recipes

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

Examples

Get address from latitude/longitude

Programming language

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

Convert coordinates to address
Find the nearest address to a latitude and longitude. results_per_page=1 returns the nearest property alone, and selecting only its address, postal code and property_id keeps the request at the identifier rate.
Request
Shell session
curl -X GET "https://api.houski.ca/geocoding?api_key=YOUR_API_KEY&latitude=51.0446&longitude=-114.0722&radius=0.5&results_per_page=1&select=address,postal_code,property_id"
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.0446');
    url.searchParams.set('longitude', '-114.0722');
    url.searchParams.set('radius', '0.5');
    url.searchParams.set('results_per_page', '1');
    url.searchParams.set('select', 'address,postal_code,property_id');

    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": 0.03,
  "data": [
    {
      "address": "513 9 Avenue SW",
      "postal_code": "T2P1G1",
      "property_id": "e9baf46145362e25"
    }
  ],
  "error": "",
  "pagination": {
    "current_page": 1,
    "has_next_page": true,
    "has_previous_page": false,
    "page_total": 5216
  },
  "price_quote": false,
  "result_total": 5216,
  "time_ms": 4614
}