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. Optional parameters
  3. Client-side requests
  4. Server-side requests
  5. Response
  6. Usage limits

Minimum acceptable accuracy
Stores are retrieved only for an accuracy of 20km or less.

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.

Optional parameters

https://api.woosmap.com/geolocation/stores/?private_key={PRIVATE_API_KEY}&radius=10000&&limit=10

limit

In addition to optional parameters from Search API you can specify a limit value to limit number of assets to retrieve from an IP location (integer value)

cc_format

To specify the country code format returned in the response. Default is alpha2.

Available cc_format values are alpha2 or alpha3.

Client-side requests

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

const woosmapKey = "woos-xxx...";
const radiusMeters = 50000;

fetch(
    `https://api.woosmap.com/geolocation/stores/?
   key=${woosmapKey}&
   radius=${radiusMeters}`
)
    .then(result => result.json())
    .then(({stores}) => {
        displayStores(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 -L -X GET '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, postal_code, timezone

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,
    "postal_code": "75000",
    "timezone": "Europe/Paris",
    "stores":{
        "type": "FeatureCollection",
        "features":[  ],
        "pagination":{
            "page": 1,
            "pageCount": 2
        }
    }
}

Usage limits

The following usage limits are in place for the /stores endpoint of Geolocation API:

Was this article helpful?
Have more questions? Submit a request