Getting Started with the Woosmap for what3words API
Explanation of available endpoints with example requests.
Before we start
To use any of the examples you will need a Woosmap Public Key with both:
- the
what3words
product is enabled for the project (Localities
is automatically enabled withwhat3words
) - the
localhost
domain whitelisted
You can follow this tutorial to learn how set up your account,
And this one to learn about Woosmap API Keys domain restrictions.
Convert to address
This endpoint will take a what3words address and return to you a list of possible street addresses. If there are no street addresses within 200m of the what3words address it will return an empty list.
For the UK do not forget to enable Localities UK Addresses add-on.
Convert-to-address endpoint is designed to provide address suggestions. As for other autocomplete or autosuggest services, you’ll need to perform an additional request to get details on a dedicated suggestion. To retrieve lat/lng and address components, perform a get details request using the `public_id contained in suggestions.
curl -L -X GET 'https://api.woosmap.com/what3words/convert-to-address?words=couch.spotted.amended&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'
import requests
url = "https://api.woosmap.com/what3words/convert-to-address?words=couch.spotted.amended&key=YOUR_PUBLIC_API_KEY"
payload={}
headers = {
'Referer': 'http://localhost'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.woosmap.com/what3words/convert-to-address?words=couch.spotted.amended&key=YOUR_PUBLIC_API_KEY", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
AutoSuggest
AutoSuggest can take a slightly incorrect 3 word address and suggest a list of valid 3 word addresses. It has powerful features that can, for example, optionally limit results to a country or area, and prioritise results that are near the user (see Clipping and Focus below).
It provides corrections for the following types of input error:
- Typing errors
- Spelling errors
- Misremembered words (e.g. singular vs. plural)
- Words in the wrong order
curl -L -X GET 'https://api.woosmap.com/what3words/autosuggest?input=couch.spotted.am&clip-to-country=fr&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'
import requests
url = "https://api.woosmap.com/what3words/autosuggest?input=couch.spotted.am&clip-to-country=fr&key=YOUR_PUBLIC_API_KEY"
payload={}
headers = {
'Referer': 'http://localhost'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.woosmap.com/what3words/autosuggest?input=couch.spotted.am&clip-to-country=fr&key=YOUR_PUBLIC_API_KEY", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Convert to what3words
You can use this endpoint to take a Latitude and Longitude and convert them into a what3words address.
curl -L -X GET 'https://api.woosmap.com/what3words/convert-to-3wa?coordinates=48.858304,2.294514&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'
import requests
url = "https://api.woosmap.com/what3words/convert-to-3wa?coordinates=48.858304,2.294514&key=YOUR_PUBLIC_API_KEY"
payload={}
headers = {
'Referer': 'http://localhost'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://api.woosmap.com/what3words/convert-to-3wa?coordinates=48.858304,2.294514&key=YOUR_PUBLIC_API_KEY", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));