Suggest Locality
This endpoint returns suggestions of localities in a specific country given certain search parameters - usually used for "autocomplete" purposes to help a user type a valid locality into a form/input field.
Endpoint URL
(GET) https://app-api.geposit.se/v2.0/suggest/locality/{COUNTRY_CODE}
where {COUNTRY_CODE} is replaced with one of the following supported country codes:
- se (Sweden)
- no (Norway)
- dk (Denmark)
- fi (Finland)
Supported parameters
Query parameter | Value |
---|---|
api_key | Required A valid API key |
query | Required The query string that will be used to filter what locality suggestions to fetch. Example: query=Sto Returns localities that begins with Sto |
max_rows | The maximum number of suggestions that should be returned. Possible values are 1 to 100. Default value is 15. Example: query=Sto&max_rows=20 Returns the first 20 localities that begins with Sto. |
response_format | Sets the format for the API response. The following values are supported: * xml * json (default) * text |
Response
Key | Value Type | Value description |
---|---|---|
version | String | The API version |
suggestions | Array | An array with zero or more suggestion objects (referenced below) If the suggestions array is empty it means that no suggestions were found. |
Status code that gives detailed information about the suggest result. This code details both general errors and detailed suggest errors.
Suggestion object
Key | Value type | Value description |
---|---|---|
locality | String | Locality / city of the address |
adm[1-5]_name | String | Administrative division - level 1 - name |
adm[1-5]_code | String | Administrative division - level 2 - code |
Examples
Example - A default request
curl https://app-api.geposit.se/v2.0/suggest/locality/se -d "query=Sto&response_format=json&api_key={API_KEY}"
{
"version": "2.0",
"suggestions": [
{
"locality": "Stoby"
},
{
"locality": "Stocka"
},
{
"locality": "Stockamöllan"
},
{
"locality": "Stockaryd"
},
{
"locality": "Stockholm"
...
]
}
<?xml version="1.0" encoding="UTF-8"?>
<api>
<version>2.0</version>
<suggestions>
<suggestion>
<locality>Stoby</locality>
</suggestion>
<suggestion>
<locality>Stocka</locality>
</suggestion>
<suggestion>
<locality>Stockamöllan</locality>
</suggestion>
<suggestion>
<locality>Stockaryd</locality>
</suggestion>
<suggestion>
<locality>Stockholm</locality>
</suggestion>
</suggestions>
</api>
Stoby
Stocka
Stockamöllan
Stockaryd
Stockholm
Stockholm-Arlanda
Stockholm-Globen
Stocksund
Stora Blåsjön
Stora Höga
Stora Levene
Stora Mellösa
Stora Skedvi
Stora Sundby
Stora Vika
Storebro
Storfors
Storlien
Storseleby
Storsjö Kapell
Updated 6 months ago