The Woosmap DevTeam has released the Search API. It’s designed to help your users find the one store they’re looking for (or maybe the few stores they’re looking for). You can use RESTful requests directly from Client and Backend development to perform quick and easy spatial and attributes searches on your locations. Results are retrieved in GeoJSON standard format for easier integration. Typical user requirements could be to search for the nearby locations from a geocoded address or to filter a list of points of sales by available facilities.
How to use it
/search REST endpoint is fully documented on Woosmap developers website.
To define a new search, start with a request like the one below (the following request retrieve all your data, paginated). Substitute your project key for
Please note that all API requests must be called through an allowed Referrer for your project key (
www.mysite.com in this example). When using cURL the referrer could be set using the
-H, --header <header> option. At the moment, you need to ask us to allow new domain names.
And for backend development, you should use your private_key instead of the public_key (which is currently restricted to client development).
You can request the API by specifying two kinds of querystrings:
Query parameter: based on location attributes using
&query=and passing the desired field, operator and value. You can filter by Types, Tags, User Attributes, Store ID and Name or any combination of these easily. See Fields topic to see samples and learn which operators are supported for each field.
Geographic parameters: around a geographical point using
&lng=(can be accessed using our recommendation API or from a geocoding service) and a
radiusparameter or nearby a polyline using
Sample Search and Filter
Below is a sample that uses the Woosmap Search API to combine a search nearby a geographic location and a filter based on store type. The nearest store (Coffee Shop) is returned only if located within a 250km radius (
&max_distance=250000) either from the user position (retrieved by calling the
getUserPosition() method from Recommendation API) or from the geocoded address (achieved with Google Geocoding API).
Find Coffee Shop Near You!
For this sample, we decided to invoke the Recommendation API, with
getUserPosition(), in the opening of the page. If you’re a known user to Woosmap, a Coffee Shop will be returned. Otherwise, you could geocode an address to get a resulted shop.
By the way, feel free to play with the checkbox “Take Away Coffee” and the number field of coffee shop retrieved to refine the results. We provide an overview of what the Rest API Call URL looks like.
If you have any questions about the content or the process described, please don’t hesitate to reach out to me through the contact page.
- Woosmap Data API documentation for how to search your locations.
- Retrieve the user position in the opening of the page with Recommendation API.