Searching for places
Basic example
To search for places around a set of geographic coordinates, use the /realtime/serp endpoint and set search_engine to google_maps_search, as in the example below:
curl --location --request POST 'https://api.webit.live/api/v1/realtime/serp' \
--header 'Authorization: Basic <credential string>' \
--header 'Content-Type: application/json' \
--data-raw '{
"search_engine": "google_maps_search",
"query": "Cinema",
"coordinates": {
"latitude": "40.7123695",
"longitude": "-74.0357317"
}
}'import requests
url = 'https://api.webit.live/api/v1/realtime/serp'
headers = {
'Authorization': 'Basic <credential string>',
'Content-Type': 'application/json'
}
data = {
"search_engine": "google_maps_search",
"query": "Cinema",
"coordinates": {
"latitude": "40.7123695",
"longitude": "-74.0357317"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.json())
const axios = require('axios');
const url = 'https://api.webit.live/api/v1/realtime/serp';
const headers = {
'Authorization': 'Basic <credential string>',
'Content-Type': 'application/json'
};
const data = {
"search_engine": "google_maps_search",
"query": "Cinema",
"coordinates": {
"latitude": "40.7123695",
"longitude": "-74.0357317"
}
};
axios.post(url, data, { headers })
.then(response => {
console.log(response.status);
console.log(response.data);
})
.catch(error => {
console.error(error);
});
package main
import (
"bytes"
"fmt"
"net/http"
"encoding/json"
)
func main() {
url := "https://api.webit.live/api/v1/realtime/serp"
payload := []byte(`{
"search_engine": "google_maps_search",
"query": "Cinema",
"coordinates": {
"latitude": "40.7123695",
"longitude": "-74.0357317"
}
}`)
headers := map[string]string{
"Authorization": "Basic <credential string>",
"Content-Type": "application/json",
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
if err != nil {
fmt.Println(err)
return
}
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
// Read the response body if needed
// body, err := ioutil.ReadAll(resp.Body)
// fmt.Println(string(body))
}
Request options
query
Required
String
The term or phrase to search for.
search_engine
Required
Enum: google_maps_search | google_maps_place | google_maps_reviews
The search engine from which to collect results.
coordinates
Optional
String or Object "@{latitude},{longitude},{zoom}z"
The coordinates to target. When using a string, zoom is required.
"coordinates": { "latitude": "40.7590562", "longitude": "-74.0042502", "zoom": "14" }
When using an object, zoom is optional.
offset
Optional
Integer
Offset the pagination position by this number of listings (eg: 20).
domain
Optional
String
Search through a custom top-level domain of Google. eg: "co.uk"
country
Optional (default = all)
String
Country used to access the target URL, use ISO Alpha-2 Country Codes i.e. US, DE, GB
locale
Optional (default = en)
String
String | LCID standard locale used for the URL request. Alternatively, user can use auto for automatic locale based on country targeting.
parse
Optional (default = true)
Enum: true | false
Instructs Nimble whether to structure the results into a JSON format or return the raw HTML.
Response
200 - OK
If the request is executed successfully and parsing is either omitted or set to true, the output will resemble the example below:
{
"status": "success",
"html_content": "...",
"status_code": 200,
"headers": {
...
},
"parsing": {
"status": "success",
"entities": {
"SearchResult": [
{
...
"nimble_reviews_link": "https://api.webit.live/api/v1/realtime/serp?search_engine=google_maps_reviews&csrf_token=cjHpY_DuJqSr5NoP8P6wuAo&place_id=ChIJ_58pLKJZwokRvRwO5eftKC8",
"nimble_place_link": "https://api.webit.live/api/v1/realtime/serp?search_engine=google_maps_place&place_id=ChIJ_58pLKJZwokRvRwO5eftKC8"
},
{...}
]
},
"total_entities_count": 20,
"entities_count": {
"SearchResult": 20
},
"metrics": {}
},
"url": "https://www.google.com/maps/search/Cinema/@40.7123695,-74.0357317,14z",
"nimble_links": {
"next_page": "https://api.webit.live/api/v1/realtime/serp?search_engine=google_maps_search&query=Cinema&coordinates=%4040.7123695%2C-74.0357317%2C14z&offset=20"
}
}Using reviews, place, and next_page links.
A successful result includes a number of follow-up links that can be used to get more information or browse through pagination. These include:
500 Error
{
"status": "error",
"task_id": "<task_id>",
"msg": "can't download the query response - please try again"
}400 Input Error
{
"status": "failed",
"msg": error
}Response Codes
200
OK.
400
The requested resource could not be reached.
401
Unauthorized/invalid credental string.
500
Internal service error.
501
An error was encountered by the proxy service.
Last updated
