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.
The /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 {public_key}
parameter.
curl -H 'Referer: https://www.mysite.com' 'https://api.woosmap.com/stores/search/?key={public_key}'
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 &lat=
, &lng=
(can be accessed using our Geolocation API or from a geocoding service) and a radius
parameter or nearby a polyline using encoded_polyline
.
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).
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.
If you want to go further
Let's start by putting in place the Woosmap Map API! In the video below, you will learn how to implemen [...]
With the help of use cases using Localities API and Data Management API, Gaël Simon (DevRel Lead at Woo [...]
Distance API will give you the walking, driving, and cycling distance and path to access the destinatio [...]
Woosmap Multisearch JS Library helps you integrate alocation search box as effectively as possible and [...]
La géolocalisation est désormais au cœur de la réussite des stratégies eCommerce. Pourtant, d'autres st [...]
and don't miss a single one of our news