Woosmap Data API now open for backend development
The Woosmap Data API enables you to develop websites and applications to retrieve and display search results from your locations data programmatically. With this API, you can use RESTful requests from backend development to get woosmap location search results in JSON format. A typical usage could be, as described in the above schema, to retrieve the nearby locations from a known web user and then request a service that fetches the product availability for each store.
How to use it
On Woosmap developers' documentation you’ll find all necessary information to work with this service. You can request the API passing two kinds of parameters:
- Geographic parameters: around a geographical point using lat, lng (that could be retrieved using our Geolocation API for user location) and a max_distance parameters or nearby a polyline using encoded_polyline and inside a defined radius parameter
- Attributes parameters: based on location attributes idstore, name, city, type (to select only stores with click & collect capabilities, for example) and tag.
Python sample request
The following sample returns the stores less than 50km
(max_distance = 50000)
from a user located in Brussels, Belgium
(user_position = {'lat': 50.840, 'lng': 4.348})
import requests
private_key = 'z6a4f926-58c3-41a8-4b2b-24ee682fef01' # your private key here
endpoint_api = 'https://api.woosmap.com/stores/search'
user_position = {'lat': 50.840, 'lng': 4.348} # a given user position
max_distance = 50000 # value in meters
session = requests.Session()
response = session.get(endpoint_api,
params={'private_key': private_key,
'lat': user_position['lat'],
'lng': user_position['lng'],
'max_distance': max_distance})
response.json()
Why only use it on backend side?
This RESTful API is only supported for backend development because you’ll need to attach to each request your private_key parameter. This key must stay private as it allows to manage all your locations data. This way, you’ll prevent malicious use of this service, like ill-intentioned developers to delete all your data.