このエンドポイントが役立つこと
レスポンスには、一致する マップ、公開されているコンテキスト、さらに結果がある場合のページネーションデータが含まれます。
使用に適した場面
オブジェクトの正確な ID がわからず、まず関連する候補を見つける必要がある場合に「検索クエリによる場所」を使用します。
まず結果と一般的なワークフローを確認し、次にパラメーターと動作するリクエスト例に進んでください。
レスポンスには、一致する マップ、公開されているコンテキスト、さらに結果がある場合のページネーションデータが含まれます。
オブジェクトの正確な ID がわからず、まず関連する候補を見つける必要がある場合に「検索クエリによる場所」を使用します。
顧客向けおよび社内の画面に、Google のデータ検索を追加します。
クエリで候補を見つけ、関連するオブジェクトを保存して後でエンリッチします。
トピック、クリエイター、競合の分析のために結果セットを収集します。
どちらのバージョンも同じタスクを解決し、同じパラメーターを受け付けます。切り替えを使ってレスポンス構造を比較し、クライアントが想定するバージョンを選んでください。
このページでバージョンを切り替えると、同じドキュメント URL でレスポンス構造を比較できます。
認証、必須パラメーター、リクエストの形は V1 と V2 で同じです。実際には、エンドポイントのパスを組み立てるときとレスポンスを読み取るときにバージョンを選びます。
主な違いはレスポンスのエンベロープです。新しい連携では V2 を使用し、既存のクライアント契約との互換性が必要な場合にのみ V1 を残してください。
どちらのバージョンでも、同じ API キーのヘッダーと同じクエリパラメーターを使用します。このドキュメントでは、まず共通のパラメーターを示し、次に各バージョンのパスとコードスニペットを示します。
| パラメーター | 必須 | 型 | 例 | 説明 |
|---|---|---|---|---|
query |
はい | str |
coffee shops |
ユーザーが入力した検索クエリ。 |
coordinates |
いいえ | str | None |
@37.7749,-122.4194 |
Optional map coordinates in Google Maps center format. Example: @37.7749,-122.4194. |
country_code |
いいえ | str |
US |
Two-letter country code used for geo-localized Google results. Example: US. |
cursor |
いいえ | str | None |
eyJmaW5nZXJwcmludCI6Ii4uLiJ9.signature |
前のレスポンスで返された次のページのカーソル。最初のページでは省略します。 |
language |
いいえ | str | None |
en |
Optional Google interface language code used for localized text fields. Example: en. |
radius_meters |
いいえ | float | None |
5000 |
Optional search radius in meters for Google Maps places search. Example: 5000. |
エンドポイントの正確なパス、URL の例、コードスニペットをコピーするときにバージョンを選んでください。上のパラメーター一覧は変わりません。
GET /api/v2/google.com/maps/places-by-querycurl --request GET \
--url "https://www.scrapestorm.net/api/v2/google.com/maps/places-by-query" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'query=coffee shops' \
# Optional parameters:
# --data-urlencode '[email protected],-122.4194'
# --data-urlencode 'country_code=US'
# --data-urlencode 'cursor=eyJmaW5nZXJwcmludCI6Ii4uLiJ9.signature'
# --data-urlencode 'language=en'
# --data-urlencode 'radius_meters=5000'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v2/google.com/maps/places-by-query"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"query": "coffee shops",
}
# Optional parameters
# params["coordinates"] = "@37.7749,-122.4194"
# params["country_code"] = "US"
# params["cursor"] = "eyJmaW5nZXJwcmludCI6Ii4uLiJ9.signature"
# params["language"] = "en"
# params["radius_meters"] = "5000"
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v2/google.com/maps/places-by-query";
const params = new URLSearchParams({
query: "coffee shops",
});
// Optional parameters
// params.set("coordinates", "@37.7749,-122.4194");
// params.set("country_code", "US");
// params.set("cursor", "eyJmaW5nZXJwcmludCI6Ii4uLiJ9.signature");
// params.set("language", "en");
// params.set("radius_meters", "5000");
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
query: "coffee shops",
};
// Optional parameters
// params.coordinates = "@37.7749,-122.4194";
// params.country_code = "US";
// params.cursor = "eyJmaW5nZXJwcmludCI6Ii4uLiJ9.signature";
// params.language = "en";
// params.radius_meters = "5000";
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"query" => "coffee shops",
];
// Optional parameters
// $query["coordinates"] = "@37.7749,-122.4194";
// $query["country_code"] = "US";
// $query["cursor"] = "eyJmaW5nZXJwcmludCI6Ii4uLiJ9.signature";
// $query["language"] = "en";
// $query["radius_meters"] = "5000";
try {
$response = $client->request("GET", "/api/v2/google.com/maps/places-by-query", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v2/google.com/maps/places-by-query"
params := url.Values{}
params.Set("query", "coffee shops")
// Optional parameters
// params.Set("radius_meters", "5000")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
プレビューには主要なフィールドとコレクションの最初の要素が含まれているため、レスポンスの形をすばやく確認できます。バージョンを切り替えると JSON の形式が変わります。
このコンパクトな JSON の例は、V2 の直近の成功した検証実行から取得したものです。
{
"success": true,
"status": "ok",
"pagination": {
"cursor": "QVFB...",
"has_more": true
},
"search_context": {
"language": "en",
"country_code": "us",
"query": "coffee san francisco"
},
"data": {
"places": {
"count": 20,
"items": [
{
"rank": 1,
"company_id": "5181132708478222499",
"name": "The Coffee Berry SF",
"feature_id": "0x80858135f0db680b:0x47e714bf5f0080a3",
"place_id": "ChIJC2jb8DWBhYARo4AAX78U50c",
"rating": 4.9,
"categories": [
"Coffee shop"
],
"category_code": "coffee",
"tags": [
"Dogs allowed"
],
"formatted_address": "1410 Lombard St, San Francisco, CA 94123",
"address": {
"street_address": "1410 Lombard St",
"locality": "San Francisco",
"postal_code": "94123",
"region": "California",
"country_code": "US"
},
"full_address": "The Coffee Berry SF, 1410 Lombard St, San Francisco, CA 94123",
"address_lines": [
"1410 Lombard St",
"San Francisco, CA 94123"
],
"neighborhood": "Marina District",
"locality": "San Francisco",
"coordinates": {
"latitude": 37.8014124,
"longitude": -122.4249979
},
"timezone": "America/Los_Angeles",
"phone_number": "+1 415-800-7073",
"website_url": "http://thecoffeeberrysf.com/",
"website_host": "thecoffeeberrysf.com",
"google_maps_url": "https://www.google.com/maps/place/?q=place_id:ChIJC2jb8DWBhYARo4AAX78U50c",
"opening_hours": {
"open_now_text": "Open",
"hours_summary": "Open · Closes 6 PM",
"today_hours": [
"7 AM–6 PM"
]
},
"accessibility_features": [
{
"code": "/geo/type/establishment_poi/has_wheelchair_accessible_entrance",
"label": "Wheelchair accessible entrance",
"available": true
},
{
"code": "/geo/type/establishment_poi/has_wheelchair_accessible_parking",
"label": "Wheelchair accessible parking lot",
"available": true
},
{
"_more_items": 3
}
],
"business_highlights": [
"LGBTQ+ friendly",
"Identifies as Latino-owned"
],
"_more_fields": "1 more fields"
},
{
"rank": 2,
"company_id": "2067360649617373617",
"name": "The Coffee Movement",
"feature_id": "0x808580f2dc1b33a1:0x1cb0bd8eb71079b1",
"place_id": "ChIJoTMb3PKAhYARsXkQt469sBw",
"rating": 4.7,
"categories": [
"Coffee shop"
],
"category_code": "coffee",
"tags": [
"Snug, minimalist cafe for artisan brews"
],
"formatted_address": "1030 Washington St, San Francisco, CA 94108",
"address": {
"street_address": "1030 Washington St",
"locality": "San Francisco",
"postal_code": "94108",
"region": "California",
"country_code": "US"
},
"full_address": "The Coffee Movement, 1030 Washington St, San Francisco, CA 94108",
"address_lines": [
"1030 Washington St",
"San Francisco, CA 94108"
],
"neighborhood": "Nob Hill",
"locality": "San Francisco",
"coordinates": {
"latitude": 37.7947671,
"longitude": -122.4102942
},
"timezone": "America/Los_Angeles",
"phone_number": null,
"website_url": "https://www.thecoffeemovement.com/",
"website_host": "thecoffeemovement.com",
"google_maps_url": "https://www.google.com/maps/place/?q=place_id:ChIJoTMb3PKAhYARsXkQt469sBw",
"opening_hours": {
"open_now_text": "Open",
"hours_summary": "Open · Closes 4 PM",
"today_hours": [
"7 AM–4 PM"
]
},
"accessibility_features": [
{
"code": "/geo/type/establishment_poi/has_wheelchair_accessible_entrance",
"label": "Wheelchair accessible entrance",
"available": true
},
{
"code": "/geo/type/establishment_poi/has_wheelchair_accessible_parking",
"label": "Wheelchair accessible parking lot",
"available": false
},
{
"_more_items": 1
}
],
"business_highlights": null,
"_more_fields": "1 more fields"
},
{
"_more_items": 18
}
]
}
}
}
このドキュメントを最初の判断材料とし、継続的な利用のためにエンドポイントを接続する前に、料金、プラットフォームのカバー範囲、連携ルールを確認してください。
これらの回答を参考に、この API メソッドがワークフロー、バージョンの選択、導入計画に合うかどうかを判断してください。
このメソッドは マップ に対して「検索クエリによる場所」を実行します。以下のコンパクトなレスポンス例で、フィールドの正確な構造を確認できます。
新しい連携では、正規化された構造を提供する V2 を選んでください。V1 は、既にプラットフォーム固有の形式を処理しているクライアントとの互換性のためにのみ使用してください。
API キーを作成し、リクエストヘッダーで送信し、表の必須パラメーターを指定してください。コード例には、正しいパスとリクエスト構造が既に含まれています。