Οδηγός ενσωμάτωσης του Housing Market API
Οι πίνακες αναφοράς, οι περιγραφές των τελικών σημείων, οι κωδικοί σφαλμάτων και τα παραδείγματα παράγονται από την προδιαγραφή του API και παραμένουν στα αγγλικά σε κάθε γλώσσα. Τα ονόματα, οι παράμετροι και οι κωδικοί είναι παντού ίδιοι.
Παραδείγματα αιτημάτων και αποκρίσεων
Τα δείγματα διαβάζουν το κλειδί από τη μεταβλητή περιβάλλοντος HMA_API_KEY. Οι τιμές στις αποκρίσεις είναι ενδεικτικές.
Έλεγχος του κλειδιού και της διεύθυνσής σας
GET /v1/ping
curl -H "x-api-key: $HMA_API_KEY" \
"https://api.housingmarketapi.com/v1/ping"{
"ok": true,
"revision": "3f9c2a1",
"key": "acme-live",
"address": "203.0.113.7"
}Λίστα ακινήτων
GET /v1/properties
curl -H "x-api-key: $HMA_API_KEY" \
"https://api.housingmarketapi.com/v1/properties?country=TH&listing_type=sale&property_type=condominium&limit=100"const base = 'https://api.housingmarketapi.com';
const headers = { 'x-api-key': process.env.HMA_API_KEY };
let cursor;
do {
const url = new URL('/v1/properties', base);
url.searchParams.set('country', 'TH');
url.searchParams.set('listing_type', 'sale');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers });
if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error}`);
const page = await res.json();
for (const property of page.data) console.log(property.id, property.price);
cursor = page.next_cursor ?? undefined;
} while (cursor);import os
import requests
base = "https://api.housingmarketapi.com"
headers = {"x-api-key": os.environ["HMA_API_KEY"]}
params = {"country": "TH", "listing_type": "sale"}
while True:
res = requests.get(f"{base}/v1/properties", headers=headers, params=params)
res.raise_for_status()
page = res.json()
for prop in page["data"]:
print(prop["id"], prop["price"])
if not page["next_cursor"]:
break
params["cursor"] = page["next_cursor"]{
"data": [
{
"id": "kQ3vXr0bT1uYvW2aP8sLgA",
"country": "TH",
"listing_type": "sale",
"property_type": "condominium",
"province": "Example Province",
"province_id": 1,
"city": "Example City",
"city_id": 11,
"area": "Example District",
"area_id": 111,
"address": "Example Road",
"post_code": null,
"latitude": 13.75,
"longitude": 100.5,
"location_precision": "approximate",
"price": 4500000,
"price_max": null,
"currency": "THB",
"bedrooms": 2,
"bathrooms": 2,
"rooms": null,
"living_area": 65,
"living_area_sqm": 65,
"lot_area": null,
"lot_area_sqm": null,
"build_year": 2019,
"published_date": "2026-09-01T00:00:00Z",
"last_updated": "2026-10-02T08:30:00Z",
"features": [],
"appliances": [],
"neighbourhood": [],
"tags": [],
"developer": "Example Developer Co., Ltd.",
"summary": "Bright two-bedroom condominium close to the station.",
"description": "Bright two-bedroom condominium close to the station. Quiet building with a pool and gym.",
"location_text": null,
"images": []
}
],
"next_cursor": "EXAMPLE-OPAQUE-CURSOR",
"has_more": true
}Ανάγνωση ενός τελικού σημείου Insights
GET /v1/insights/prices
{
"data": [
{
"period_start": "2026-09-01",
"period_end": "2026-09-30",
"geography": {
"level": "city",
"id": 11,
"name": "Example City"
},
"suppressed": false,
"currency": "THB",
"median_price": 4200000,
"median_price_per_sqm": 68000,
"listing_count": 310
}
],
"meta": {
"country": "TH",
"level": "city",
"granularity": "month",
"suppression_min_cell": 10
},
"next_cursor": null,
"has_more": false
}Ένα σφάλμα
{
"error": "upgrade_required",
"message": "Insights are included in the Advanced tier."
}