The /suggest/autocomplete endpoint provides autocomplete/typeahead suggestions for resort search queries.
GET /suggest/autocomplete
q (string, required)Search query term for autocomplete suggestions. Searches against resort names only.
Minimum length: Typically 1-2 characters for useful results
Examples:
q=Try - Returns resorts matching "Try" (e.g., Trysil)q=Oslo - Returns resorts with "Oslo" in nameq=Hemse - Returns "Hemsedal"q=stor - Returns resorts with "stor" in nameNote: Search is case-insensitive and uses SQL LIKE matching with wildcards (%query%).
{
"total": 12,
"more_results": true,
"result": [
{
"name": "Trysil",
"site_path": "/trysil/"
},
{
"name": "Trysilhøgda",
"site_path": "/trysilhogda/"
},
{
"name": "Oslo Vinterpark",
"site_path": "/oslo-vinterpark/"
},
{
"name": "Norefjell",
"site_path": "/norefjell/"
},
{
"name": "Kongsberg Skisenter",
"site_path": "/kongsberg/"
},
{
"name": "Varingskollen Alpinsenter",
"site_path": "/varingskollen/"
},
{
"name": "Hafjell",
"site_path": "/hafjell/"
},
{
"name": "Kvitfjell",
"site_path": "/kvitfjell/"
},
{
"name": "Gausdal",
"site_path": "/gausdal/"
},
{
"name": "Skeikampen",
"site_path": "/skeikampen/"
}
]
}
{
"error": "Missing required parameter: q"
}
total (integer): Total number of matching resorts foundmore_results (boolean): Whether there are more results beyond the returned set
true - More results exist (total > 10)false - All matching results are includedresult (array): Array of matching resort suggestions (maximum 10)Each suggestion in result contains:
name (string): Resort namesite_path (string): URL path for the resort (e.g., "/trysil/")
When exactly one resort matches the query, each result object also includes:
nearby (array): The 3 nearest resorts to help users discover alternatives
distance (integer, meters), name, site_path, id, sortExample with single match:
{
"total": 1,
"more_results": false,
"result": [
{
"name": "Trysil",
"site_path": "/trysil/",
"nearby": [
{
"distance": 45300,
"name": "Sjusjøen",
"site_path": "/sjusjoen/",
"id": 89,
"sort": "0"
}
]
}
]
}
name onlyquery%), then "word starts with" (% query%), then falls back to "contains" (%query%)GET /suggest/autocomplete?q=Trysil
Response:
{
"total": 2,
"more_results": false,
"result": [
{
"name": "Trysil",
"site_path": "/trysil/"
},
{
"name": "Trysilhøgda",
"site_path": "/trysilhogda/"
}
]
}
GET /suggest/autocomplete?q=Oslo
Response:
{
"total": 5,
"more_results": false,
"result": [
{
"name": "Oslo Vinterpark",
"site_path": "/oslo-vinterpark/"
},
{
"name": "Varingskollen Alpinsenter",
"site_path": "/varingskollen/"
}
]
}
(Note: May include resorts with "Oslo" in description even if not in name)
GET /suggest/autocomplete?q=ski
Response:
{
"total": 35,
"more_results": true,
"result": [
{
"name": "Kongsberg Skisenter",
"site_path": "/kongsberg/"
},
{
"name": "Hemsedal Skisenter",
"site_path": "/hemsedal/"
}
// ... 8 more results (10 total)
]
}
(Note: more_results: true indicates 25 additional matches not shown)
GET /suggest/autocomplete?q=H
Response:
{
"total": 18,
"more_results": true,
"result": [
{
"name": "Hafjell",
"site_path": "/hafjell/"
},
{
"name": "Hemsedal",
"site_path": "/hemsedal/"
}
// ... up to 10 results
]
}
// Debounced autocomplete handler
let timeout;
function handleAutocomplete(query) {
clearTimeout(timeout);
timeout = setTimeout(async () => {
if (query.length < 2) return; // Wait for at least 2 characters
const response = await fetch(`/suggest/autocomplete?q=${encodeURIComponent(query)}`);
const data = await response.json();
// Display suggestions
displaySuggestions(data.result);
// Optionally show "X more results" if data.more_results is true
if (data.more_results) {
showMoreResultsIndicator(data.total - data.result.length);
}
}, 300); // 300ms debounce
}
q parameter is required; omitting it returns an errornearby array with 3 nearest resorts is includedmore_results flag indicates if the user should narrow their searchtotal count includes all matching resorts, not just the returned 10/search endpoint for full-featured search with pagination and filteringsite_path can be appended to your base URL to link directly to resort pagesq=) returns an error (minimum 1 character required)