Search Stores Nearby a User's Device Location

How to search stores nearby a user's device based on its ip address
  1. Overview
  2. Client-side requests
  3. Server-side requests
  4. Response

Overview

This API endpoint allows you to retrieve the stores nearby an ip location. Stores are returned only if a relevant ip location is found. For narrowing down the nearby stores, please refer to the search API as this endpoint accepts the same parameters.

You can query the API using your public or private key according to your use case and calls origins.

Client-side requests

For client-side requests, use your public key (parameter key) related to your project.

$.ajax({
    url: 'https://api.woosmap.com/geolocation/stores/',
    type: 'GET',
    dataType:'json',
    data: { 
        key:[YOUR_PUBLIC_KEY],  
        radius:30000
    },
    success: function(data) {
        console.log(data.stores);
    }
});

Server-side requests

For server-side requests, get stores nearby the position of a specific ip address using a private_key in your requests.

curl 'https://api.woosmap.com/geolocation/stores/?private_key={private_key}&ip_address={ip_to_geolocalize}&radius=3000&query=type:grocery'

Response

The Response is a formated JSON containing the keys: country_code, country_name, continent, city, region_state

According to IP data relevance, JSON can contain the device location and nearby stores (based on your query)

{
    "country_code": "FR",
    "country_name": "France",
    "continent": "Europe",
    "city": "My City",
    "region_state": "my-region",
    "latitude": 44.9759,
    "longitude": -93.2166,
    "stores":{
        "type": "FeatureCollection",
        "features":[  ],
        "pagination":{
            "page": 1,
            "pageCount": 2
        }
    }
}
Was this article helpful?
Have more questions? Submit a request