Samples

Search samples

  1. Sample data
  2. Sample Queries
  3. Sample Search API
  4. Sample Autocomplete Search API

For all the following examples, you have to use this URL:

Shell
        https://api.woosmap.com/stores/search/?private_key={private_key}&query='your_query'

    

To test your query, we recommend the use of cURL. Postman could be a good alternative for people who are not familiar with command line tool.

Sample data

JSON
        {
    "stores": [
        {
            "store_id": "first",
            "name": "My cool store",
            "tags": ["grocery", "apple"],
            "user_properties": {
                "rating": 3,
                "seats": 345
            }
        },
        {
            "store_id": "second",
            "name": "My Second Store",
            "tags": ["lightsaber", "samsung"],
            "user_properties": {
                "rating": 5
            }
        }
    ]
}

    

Sample Queries

Search for assets which have a user property rating greater than 3:

        user.rating:>3 //matches My cool store

    

Search for assets which have a user property rating equal to 5:

        user.rating:5 //matches My Second Store

    

Search for assets which have idstore corresponding to My cool store and seats from user_properties is equal to 345

        idstore:="My cool store" AND user.seats:345

    

Search for assets which have idstore corresponding to My cool store and seats from user_properties is greater than 300

        idstore:="My cool store" AND user.seats:>300

    

Search for assets which have idstore corresponding to My cool store and seats from user_properties is smaller than 400

        idstore:="My cool store" AND user.seats:<400

    

Search for assets which doesn’t have the grocery type.

        NOT type:"grocery"

    

Sample Search API

Here we search stores nearby a location and within a radius of 300 meters.

Sample Search call
        https://api.woosmap.com/stores/search/
  ?lat=51.50976
  &lng=-0.145276
  &radius=300
  &key=YOUR_PUBLIC_API_KEY
    
        curl -L -X GET 'https://api.woosmap.com/stores/search/?lat=51.50976&lng=-0.145276&radius=300&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'

    
        var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.woosmap.com/stores/search/?lat=51.50976&lng=-0.145276&radius=300&key=YOUR_PUBLIC_API_KEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

    
        var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://api.woosmap.com/stores/search/?lat=51.50976&lng=-0.145276&radius=300&key=YOUR_PUBLIC_API_KEY',
  headers: { 
    'Referer': 'http://localhost'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});


    
        import requests

url = "https://api.woosmap.com/stores/search/?lat=51.50976&lng=-0.145276&radius=300&key=YOUR_PUBLIC_API_KEY"

payload={}
headers = {
    'Referer': 'http://localhost'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)


    
        OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.woosmap.com/stores/search/?lat=51.50976&lng=-0.145276&radius=300&key=YOUR_PUBLIC_API_KEY")
  .method("GET", body)
  .addHeader("Referer", "http://localhost")
  .build();
Response response = client.newCall(request).execute();

    
        require "uri"
require "net/http"

url = URI("https://api.woosmap.com/stores/search/?lat=51.50976&lng=-0.145276&radius=300&key=YOUR_PUBLIC_API_KEY")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Referer"] = "http://localhost"

response = https.request(request)
puts response.read_body


    

For this query the Search API will return the following content:

Sample Search response
JSON
        {
  "type": "FeatureCollection",
  "features":
    [
      {
        "type": "Feature",
        "properties":
          {
            "store_id": "2354",
            "name": "Berkeley Street/Berkeley Square",
            "contact":
              {
                "phone": "02076295779",
                "website": "https://www.starbucks.com/store-locator/store/2354/berkeley-street-berkeley-square-27-berkeley-st-berkeley-square-london-eng-w-1-x-5-",
              },
            "address":
              {
                "lines": ["27 Berkeley St", "London, ENG W1X 5AD"],
                "country_code": "GB",
                "city": "London",
                "zipcode": "W1X 5AD",
              },
            "user_properties": { "take_away": "available" },
            "tags": ["WA", "WF", "CD", "DR", "XO"],
            "types": ["Coffee shop"],
            "last_updated": "2022-11-10T13:23:53.564829+00:00",
            "distance": 135.28682936,
            "open":
              {
                "open_now": true,
                "open_hours": [{ "end": "18:00", "start": "06:30" }],
                "week_day": 5,
                "current_slice": { "end": "18:00", "start": "06:30" },
              },
            "weekly_opening":
              {
                "1":
                  {
                    "hours": [{ "end": "18:00", "start": "06:30" }],
                    "isSpecial": false,
                  },
                "2":
                  {
                    "hours": [{ "end": "18:00", "start": "06:30" }],
                    "isSpecial": false,
                  },
                "3":
                  {
                    "hours": [{ "end": "18:00", "start": "06:30" }],
                    "isSpecial": false,
                  },
                "4":
                  {
                    "hours": [{ "end": "18:00", "start": "06:30" }],
                    "isSpecial": false,
                  },
                "5":
                  {
                    "hours": [{ "end": "18:00", "start": "06:30" }],
                    "isSpecial": false,
                  },
                "6":
                  {
                    "hours": [{ "end": "17:00", "start": "08:00" }],
                    "isSpecial": false,
                  },
                "7":
                  {
                    "hours": [{ "end": "17:00", "start": "08:00" }],
                    "isSpecial": false,
                  },
                "timezone": "Europe/London",
              },
            "opening_hours":
              {
                "usual":
                  {
                    "1": [{ "end": "18:00", "start": "06:30" }],
                    "2": [{ "end": "18:00", "start": "06:30" }],
                    "3": [{ "end": "18:00", "start": "06:30" }],
                    "4": [{ "end": "18:00", "start": "06:30" }],
                    "5": [{ "end": "18:00", "start": "06:30" }],
                    "6": [{ "end": "17:00", "start": "08:00" }],
                    "7": [{ "end": "17:00", "start": "08:00" }],
                  },
                "special": {},
                "timezone": "Europe/London",
              },
          },
        "geometry": { "type": "Point", "coordinates": [-0.14408, 51.5088] },
      },
    ],
  "pagination": { "page": 1, "pageCount": 1 },
}

    

Sample Autocomplete Search API

Here we assume that the user typed street and we send his request with the parameter language set to en.

Sample Autocomplete call
        https://api.woosmap.com/stores/autocomplete/
  ?language=en
  &limit=3
  &query=localized%3Astreet
  &key=YOUR_PUBLIC_API_KEY
    
        curl -L -X GET 'https://api.woosmap.com/stores/autocomplete/?language=en&query=localized%3Astreet&limit=3&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'

    
        var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.woosmap.com/stores/autocomplete/?language=en&query=localized%3Astreet&limit=3&key=YOUR_PUBLIC_API_KEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

    
        var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://api.woosmap.com/stores/autocomplete/?language=en&query=localized%3Astreet&limit=3&key=YOUR_PUBLIC_API_KEY',
  headers: { 
    'Referer': 'http://localhost'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});


    
        import requests

url = "https://api.woosmap.com/stores/autocomplete/?language=en&query=localized%3Astreet&limit=3&key=YOUR_PUBLIC_API_KEY"

payload={}
headers = {
    'Referer': 'http://localhost'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)


    
        OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.woosmap.com/stores/autocomplete/?language=en&query=localized%3Astreet&limit=3&key=YOUR_PUBLIC_API_KEY")
  .method("GET", body)
  .addHeader("Referer", "http://localhost")
  .build();
Response response = client.newCall(request).execute();

    
        require "uri"
require "net/http"

url = URI("https://api.woosmap.com/stores/autocomplete/?language=en&query=localized%3Astreet&limit=3&key=YOUR_PUBLIC_API_KEY")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Referer"] = "http://localhost"

response = https.request(request)
puts response.read_body


    

For this query the Autocomplete API will return the following content:

Sample Autocomplete response
JSON
        {
  "predictions":
    [
      {
        "store_id": "2670",
        "name": "Sun Street",
        "types": ["Coffee shop"],
        "matched_substrings": [{ "offset": 4, "length": 6 }],
        "highlighted": "Sun <b>Street</b>",
      },
      {
        "store_id": "16069",
        "name": "7th Street",
        "types": ["Coffee shop"],
        "matched_substrings": [{ "offset": 4, "length": 6 }],
        "highlighted": "7th <b>Street</b>",
      },
      {
        "store_id": "1013873",
        "name": "The Street",
        "types": ["Coffee shop"],
        "matched_substrings": [{ "offset": 4, "length": 6 }],
        "highlighted": "The <b>Street</b>",
      },
      {
        "store_id": "1008896",
        "name": "12th Street",
        "types": ["Coffee shop"],
        "matched_substrings": [{ "offset": 5, "length": 6 }],
        "highlighted": "12th <b>Street</b>",
      },
      {
        "store_id": "1023565",
        "name": "Doha Street",
        "types": ["Coffee shop"],
        "matched_substrings": [{ "offset": 5, "length": 6 }],
        "highlighted": "Doha <b>Street</b>",
      },
    ],
}

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