Autocomplete with caretpos
1 min read
Autocomplete
For an address field with suggestions as the user types:
GET /v1/autocomplete?q=<text>&type=<adresse|adgangsadresse>
q: the text the user typed.type:adresse(unit address) oradgangsadresse(house-number level).postnr/kommunekode: optional narrowing.limit: up to 50 (default 20).
caretpos (the cursor position in q) is only used by the DAWA engine: use /dawa/autocomplete, or add motor=dawa on /v1/autocomplete.
Bash
curl -H "Authorization: Bearer <key>" \
"https://api.danskadresseapi.dk/dawa/autocomplete?q=rådhusplads&caretpos=10&type=adgangsadresse"DAWA parity: /dawa/autocomplete and /dawa/adresser/autocomplete behave like the official DAWA (same ranking and fields).
Autocomplete is built for fast keystrokes. To fully validate a typed address, use datavask — see that article.
Was this helpful?
