Google Maps Nearby Search API

Search Google Maps around an exact latitude and longitude and get up to 20 normalized places per call, each with the address broken into street, city, state, postal code and country. Use this when you have coordinates and want the map viewport centred on them; use maps.search when you only have a place name. Pass the returned nextCursor back as cursor for the next 20 places.

USD 0.001300 / appel réussi

ID public: places.search.nearby · Version 1

Tarifs

USD 0.001300 / appel réussi

Démarrage rapide

Recherchez cet outil avec votre clé API, puis inspectez le provider et le endpoint renvoyés avant de lancer une exécution.

Définissez GLOOP_API_BASE sur votre adresse API et GLOOP_API_KEY sur votre clé côté serveur.

curl

curl --fail-with-body "${GLOOP_API_BASE%/}/v1/discover" \
  -H "Authorization: Bearer $GLOOP_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit": 5,
  "query": "Google Maps Nearby Search"
}'

Python

import os, json, urllib.request

url = os.environ['GLOOP_API_BASE'].rstrip('/') + "/v1/discover"
headers = {'Authorization': 'Bearer ' + os.environ['GLOOP_API_KEY']}
headers['Content-Type'] = 'application/json'
data = "{\n  \"limit\": 5,\n  \"query\": \"Google Maps Nearby Search\"\n}".encode('utf-8')
request = urllib.request.Request(url, data=data, headers=headers)
with urllib.request.urlopen(request) as response:
    print(json.load(response))

Node.js

const url = process.env.GLOOP_API_BASE.replace(/\/$/, '') + "/v1/discover";
const headers = { Authorization: `Bearer ${process.env.GLOOP_API_KEY}` };
headers['Content-Type'] = 'application/json';
const response = await fetch(url, { method: 'POST', headers, body: JSON.stringify({
  "limit": 5,
  "query": "Google Maps Nearby Search"
}) });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
Documentation API des outils · POST /v1/inspect

Schéma d'entrée

{
  "additionalProperties": false,
  "properties": {
    "coordinates": {
      "additionalProperties": false,
      "description": "The exact map centre to search around. Use maps.search instead if you only have a place name.",
      "properties": {
        "latitude": {
          "description": "Latitude of the map centre in decimal degrees.",
          "maximum": 90,
          "minimum": -90,
          "type": "number"
        },
        "longitude": {
          "description": "Longitude of the map centre in decimal degrees.",
          "maximum": 180,
          "minimum": -180,
          "type": "number"
        }
      },
      "required": [
        "latitude",
        "longitude"
      ],
      "type": "object"
    },
    "cursor": {
      "description": "Opaque cursor from a previous response's nextCursor. Pass it back to get the next page of places.",
      "type": "string"
    },
    "language": {
      "description": "Two-letter language code for the results (e.g. en).",
      "type": "string"
    },
    "limit": {
      "description": "Accepted but does not change the page: every call returns one full Google Maps viewport of about 20 places, never trimmed, so nextCursor continues exactly where this response ended. Price is flat per request.",
      "maximum": 20,
      "minimum": 1,
      "type": "integer"
    },
    "query": {
      "description": "What you would type in the Google Maps search bar (e.g. coffee shop).",
      "minLength": 1,
      "type": "string"
    },
    "zoom": {
      "description": "Google Maps viewport zoom. Lower covers a wider area, higher focuses more tightly around the coordinates.",
      "maximum": 21,
      "minimum": 3,
      "type": "number"
    }
  },
  "required": [
    "query",
    "coordinates"
  ],
  "type": "object"
}

Schéma de sortie

{
  "type": "object"
}