# FlashData Google Places API

ค้นหาธุรกิจและสถานที่ท้องถิ่น รับข้อมูลชื่อ, ที่อยู่, พิกัด, เรตติ้ง และรายละเอียดการติดต่อ เมื่อมีการใช้งาน

อ้างอิงทางคลอง: https://flashdata.dev/th/docs/sources/google_places
Recorder: 2026-10-23

จุดสิ้นสุด: POST https://data.flashdata.dev/v1/queries/realtime
การยืนยันตัวตน: X-API-Key: YOUR_API_KEY
โหมด: [Realtime](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#realtime) · [Async](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#async) · [Batch](https://flashdata.dev/th/docs/reference/batch-and-bulk/reference.md#batch)

ต้องการสิทธิ์ที่อนุญาตจากแหล่ง: google_places

แทนที่ YOUR_API_KEY ด้วย API กุญแจที่มีแหล่งที่ได้รับอนุญาตนี้ และหน่วยกิตที่มีอยู่ ประมวลผลการร้องขอบนเซิร์ฟเวอร์หรือโฮสต์ตัวแทนของคุณ

[ตั้งค่าการตรวจสอบสิทธิ์](https://flashdata.dev/th/docs/guides/headers-and-authentication/reference.md)

[เลือกและ ขัดมัน Google ค้นหา](https://flashdata.dev/th/docs/guides/google-search-guide/reference.md)

<a id="quickstart"></a>

## ส่งคําขอมา

### Python

```bash
python3 -m pip install requests
```

```python
import json

import requests

api_key = "YOUR_API_KEY"
payload = {
    "source": "google_places",
    "query": "coffee in san francisco",
    "params": {
        "gl": "us",
        "hl": "en",
        "num": 10,
        "page": 1,
    },
}

response = requests.post(
    "https://data.flashdata.dev/v1/queries/realtime",
    headers={"X-API-Key": api_key},
    json=payload,
    timeout=120,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2))
```

### Bash / cURL

```bash
api_key="YOUR_API_KEY"
curl --fail-with-body --max-time 120 --request POST "https://data.flashdata.dev/v1/queries/realtime" \
  --header "Content-Type: application/json" \
  --header "X-API-Key: $api_key" \
  --data-binary @- <<'FLASHDATA_JSON'
{
  "source": "google_places",
  "query": "coffee in san francisco",
  "params": {
    "gl": "us",
    "hl": "en",
    "num": 10,
    "page": 1
  }
}
FLASHDATA_JSON
```

<a id="parameters"></a>

## พารามิเตอร์

<a id="parameters-group-0"></a>

### เนื้อหาคำขอ

| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คําอธิบาย |
| --- | --- | --- | --- | --- |
| <a id="parameter-source"></a> source | string | ใช่ | — | กําหนดเป็น google_places  |
| <a id="parameter-query"></a> query | string | ใช่ | ยังไม่ได้ตั้งค่า | สืบค้น การรองรับ Google ผู้ดําเนินการการค้นหาเช่นเว็บไซต์: และเนื้อหา: ความยาวน้อยที่สุด: 1. ความยาวสูงสุด: 2000. |
| <a id="parameter-params"></a> params | object | ไม่ | {} | Settings สําหรับการร้องขอนี้  |
| <a id="parameter-callback_url"></a> callback_url | string · nullable | ไม่ | ยังไม่ได้ตั้งค่า | Async และชุดเท่านั้น สาธารณะ HTTPS เสร็จสมบูรณ์แล้ว URL บนพอร์ต 443ถึง 2,048 ตัวละคร ไม่มีเอกสารรับรองผู้ใช้หรือส่วน URL Omit, ใช้ null หรือข้อความเปล่าสําหรับไม่ให้แจ้งเตือน ในชุดนี้ กําหนดให้แต่ละคําถาม ภายนอกพม่า  |

<a id="parameters-group-1"></a>

### ประเทศ, ตําแหน่งภาษา

| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คําอธิบาย |
| --- | --- | --- | --- | --- |
| <a id="parameter-params-gl"></a> params.gl | string | ไม่ | ยังไม่ได้ตั้งค่า | รหัสประจําประเทศ 2 ตัว เช่นเรา จีบี หรือ เอสจี ตั้งค่าโดยตรงเพื่อเลือกประเทศ ความยาวน้อยที่สุด: 2. ความยาวสูงสุด: 2. รูปแบบ: ^[A-Za-z]{2}$ |
| <a id="parameter-params-hl"></a> params.hl | string | ไม่ | ยังไม่ได้ตั้งค่า | Google ภาษาอินเตอร์เฟส ตั้งค่าโดยตรงเพื่อเลือกภาษา ความยาวน้อยที่สุด: 1. ความยาวสูงสุด: 35. รูปแบบ: ^[A-Za-z0-9-]+$ |
| <a id="parameter-params-location"></a> params.location | string | ไม่ | ยังไม่ได้ตั้งค่า | ร้องขอสถานที่ค้นหา โดยเฉพาะอย่างยิ่งเป็นเมือง เช่น "London, England, United Kingdom" ความสามารถขึ้นอยู่กับชนิดของการค้นหา ความยาวน้อยที่สุด: 1. ความยาวสูงสุด: 200. |

<a id="parameters-group-2"></a>

### การวางพาเนล

| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คําอธิบาย |
| --- | --- | --- | --- | --- |
| <a id="parameter-params-num"></a> params.num | integer | ไม่ | ยังไม่ได้ตั้งค่า | ร้องขอผลนับ FlashData ไม่ได้ทําการเพิ่มค่าค่าปริยายที่คงที่เมื่อลบทิ้ง จํานวน ที่ กลับ มา อาจ ต่าง กัน ได้ โดย การ สอบ ถาม และ ชนิด การ ค้นคว้า. น้อยที่สุด: 1. ค่าสูงสุด: 100. |
| <a id="parameter-params-page"></a> params.page | integer | ไม่ | ยังไม่ได้ตั้งค่า | หน้าผลการขอ ตั้งให้ตรง. แต่ละหน้าเป็นการร้องขอแยก API น้อยที่สุด: 1. ค่าสูงสุด: 100. |

<a id="parameters-group-3"></a>

### ตัวกรองการค้นหา

| พารามิเตอร์ | ชนิด | จำเป็น | ค่าเริ่มต้น | คําอธิบาย |
| --- | --- | --- | --- | --- |
| <a id="parameter-params-tbs"></a> params.tbs | string | ไม่ | ยังไม่ได้ตั้งค่า | ต้องการ Google ตัวกรองสําหรับค้นหา เช่น Qdr: d สําหรับวันที่ผ่านมา หรือ qdr: w สําหรับสัปดาห์ที่ผ่านมา ความสามารถขึ้นอยู่กับชนิดของการค้นหา ความยาวน้อยที่สุด: 1. ความยาวสูงสุด: 200. |
| <a id="parameter-params-autocorrect"></a> params.autocorrect | boolean | ไม่ | ยังไม่ได้ตั้งค่า | ต้องการแก้ไขคําสะกดด้วย true หรือร้องขอให้ปิดการทํางาน false. พฤติกรรมประยุกต์ขึ้นอยู่กับชนิดของการค้นหา; การแทนที่ที่จะใช้ Googleพฤติกรรม  |

<a id="response"></a>

## อ่านผลที่ออกมา

บันทึกความสําเร็จ JSON ตอบกลับเป็น response.json. บันทึกนี้เป็น read-response.py และเรียกไพธอน read-response.py. มันใช้เฉพาะ Pythonห้องสมุดมาตรฐาน และไม่มีการร้องขอใหม่

### read-response.py

```python
import json
from pathlib import Path

response = json.loads(Path("response.json").read_text(encoding="utf-8-sig"))
if response.get("status") not in ("done", "completed") or not isinstance(response.get("results"), list):
    raise SystemExit("Expected completed result JSON; inspect the response or job status.")
if not response["results"]:
    print("[]")
    raise SystemExit(0)
result = response["results"][0]

output = [
    {name: item.get(name) for name in ("title", "address", "latitude", "longitude", "website")}
    for item in result.get("places", [])
]
print(json.dumps(output, ensure_ascii=False, indent=2))
```

## ตัวอย่างคำตอบ

ตัว อย่าง ที่ บันทึก ไว้; ทุ่ง นา และ การ นับ ขึ้น อยู่ กับ แหล่ง กําเนิด และ ข้อ เรียก ร้อง ให้ นํา เข้า.
```json
{
  "source": "google_places",
  "status": "done",
  "results": [
    {
      "searchParameters": {
        "q": "coffee in san francisco",
        "gl": "us",
        "hl": "en",
        "type": "places",
        "num": 10,
        "page": 1,
        "engine": "google"
      },
      "places": [
        {
          "position": 1,
          "title": "Kopê House",
          "address": "546 Laguna St",
          "latitude": 37.776222,
          "longitude": -122.42606,
          "rating": 4.9,
          "ratingCount": 76,
          "priceLevel": "$1–10",
          "category": "Cafe",
          "cid": "7430826673754830499"
        },
        {
          "position": 2,
          "title": "The Coffee Berry SF",
          "address": "1410 Lombard St",
          "latitude": 37.80141,
          "longitude": -122.424995,
          "rating": 4.9,
          "ratingCount": 642,
          "priceLevel": "$1–10",
          "category": "Coffee shop",
          "cid": "5181132708478222499"
        },
        {
          "position": 3,
          "title": "Sightglass Coffee",
          "address": "270 7th St",
          "latitude": 37.77704,
          "longitude": -122.40844,
          "rating": 4.4,
          "ratingCount": 3400,
          "priceLevel": "$10–20",
          "category": "Coffee shop",
          "cid": "13926460886861596347"
        },
        {
          "position": 4,
          "title": "Origin Lab Coffee & Matcha",
          "address": "211 Sutter St",
          "latitude": 37.789722,
          "longitude": -122.404175,
          "rating": 4.7,
          "ratingCount": 624,
          "priceLevel": "$1–10",
          "category": "Coffee shop",
          "cid": "9114931074474087601"
        },
        {
          "position": 5,
          "title": "The Coffee Movement",
          "address": "1737 Balboa St",
          "latitude": 37.7765,
          "longitude": -122.477806,
          "rating": 4.8,
          "ratingCount": 623,
          "priceLevel": "$1–10",
          "category": "Coffee shop",
          "cid": "2726196137705445702"
        },
        {
          "position": 6,
          "title": "Third Wheel Coffee",
          "address": "991 Oak St",
          "latitude": 37.77323,
          "longitude": -122.43559,
          "rating": 4.9,
          "ratingCount": 266,
          "priceLevel": "$1–10",
          "category": "Coffee shop",
          "cid": "1837357391573517555"
        },
        {
          "position": 7,
          "title": "Better Half Coffee",
          "address": "1448 Pacific Ave",
          "latitude": 37.79555,
          "longitude": -122.41909,
          "rating": 4.9,
          "ratingCount": 123,
          "priceLevel": "$10–20",
          "category": "Coffee shop",
          "cid": "11196405476986641272"
        },
        {
          "position": 8,
          "title": "Sextant Coffee Roasters",
          "address": "1415 Folsom St",
          "latitude": 37.772472,
          "longitude": -122.412964,
          "rating": 4.4,
          "ratingCount": 746,
          "priceLevel": "$1–10",
          "category": "Coffee shop",
          "cid": "16500984014294458956"
        },
        {
          "position": 9,
          "title": "Doppio Coffee & Brunch",
          "address": "1551 Mission St",
          "latitude": 37.773315,
          "longitude": -122.418015,
          "rating": 4.8,
          "ratingCount": 494,
          "priceLevel": "$10–20",
          "category": "Coffee shop",
          "cid": "16475263059648961979"
        },
        {
          "position": 10,
          "title": "Delah Coffee",
          "address": "370 4th St",
          "latitude": 37.781017,
          "longitude": -122.40022,
          "rating": 4.6,
          "ratingCount": 1200,
          "priceLevel": "$10–20",
          "category": "Coffee shop",
          "cid": "10682847123881919373"
        }
      ]
    }
  ],
  "usage": {
    "credits": 0.02
  },
  "created_at": "2026-09-16T07:41:45.679Z"
}
```

## ช่องข้อมูลแบบวนรอบ

| ช่องข้อมูล | ชนิด | คําอธิบาย |
| --- | --- | --- |
| source | string | สิ่งที่ร้องขอมา API แหล่งข่าว |
| status | string | เสร็จสิ้นเมื่อการร้องขอจริง สําเร็จ |
| created_at | string | ช่วงเวลาการสร้างแบบ ISO 8601 |
| usage.credits | number | บัตรเครดิตตามที่ขอ จากแผนของคุณ |
| results[0].searchParameters | object | ตั้งค่าการค้นหาโดย Google โดยมีการสืบค้นเป็น Q การตั้งค่าที่ส่งกลับอาจจะแตกต่างจากค่าที่ต้องการ |
| results[0].places | array | ผลการค้นหาท้องถิ่น |
| results[0].places[].title | string | สถานที่หรือชื่อธุรกิจ |
| results[0].places[].address | string · optional | ที่อยู่ถนน |
| results[0].places[].latitude | number · optional | ความน่าเบื่อ |
| results[0].places[].longitude | number · optional | ลองติจูด |
| results[0].places[].rating | number · optional | เรตติ้งเฉลี่ย |
| results[0].places[].ratingCount | integer · optional | จํานวนของเรตติ้ง |
| results[0].places[].category | string · optional | ประเภทธุรกิจ. |
| results[0].places[].phoneNumber | string · optional | หมายเลขโทรศัพท์ |
| results[0].places[].website | string · optional | เว็บไซต์ธุรกิจ. |
| results[0].places[].cid | string · optional | Google. แสดงตัวตําแหน่ง |
| results[0].places[].position | integer | ตําแหน่งที่มีผล |
| results[0].places[].priceLevel | string · optional | แสดงระดับของราคาเมื่อมีใช้งาน |

- ช่องข้อมูลที่มีอยู่จะขึ้นอยู่กับการค้นหาและชนิดการค้นหา อาจ ไม่ มี ทุ่ง นา แห่ง อื่น และ อาจ ได้ รับ การ กลับ มา อีก.
- จํานวนรายการที่ส่งคืนและ searchParameters.num แตกต่างจาก params.num. ใช้อาร์เรย์ที่ส่งกลับเพื่อตรวจจํานวนผลลัพธ์ที่มีผลจริง

## รูปแบบคำตอบ

การตอบสนองต่าง ๆ ใช้ JSON โดยปริยายแล้ว เลือกรูปแบบอื่นด้วยส่วนหัวแบบเสริมเหล่านี้

- Accept: application/json (ค่าปริยาย) หรือ text/plain. ข้อความธรรมดาแสดงสนามเดียวกัน ในผังที่อ่านได้ และไม่สามารถเปลี่ยนแปลงได้
- X-Respond-With: markdown. ไม่ต้องตั้งค่าสําหรับสนามเดิม Markdown ทํางานกับรูปแบบการตอบสนองต่าง ๆ

Markdown มีการใช้งานสําหรับลําดับเวลาจริงและผลลัพธ์ที่เสร็จสมบูรณ์

ช่องข้อมูลด้านล่างนี้ ใช้อธิบายค่าปริยาย JSON ตอบสนอง

[ตัวอย่างการร้องขอและรูปแบบการตอบสนอง](https://flashdata.dev/th/docs/guides/response-formats/reference.md#headers)

<a id="job-lifecycle"></a>

<a id="async-batch"></a>

## พื้นฐาน API

ตัวสร้างและตัวอย่างที่ต้องการด้านบน ใช้พารามิเตอร์ของแหล่งนี้ ใช้ Python ถึง cURL ตัวอย่างด้านล่างนี้ สําหรับการร่วมยอมจํานน สถานะ และขั้นตอนที่มีผล A Batch ร่างกายคือ JSON ออบเจกต์ที่มีลําดับ; แต่ละรายการจะคืนงานของมันเอง ID.

- [Async ร้องขอและใบเสร็จ](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#async)

<a id="job-status"></a>

- [ตรวจสอบสถานะงานพิมพ์](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#status)

<a id="job-results"></a>

- [ดึงข้อมูลผลลัพธ์ที่เสร็จสมบูรณ์แล้ว](https://flashdata.dev/th/docs/reference/realtime-and-async/reference.md#results)
- [Batch JSON ต้องการ](https://flashdata.dev/th/docs/reference/batch-and-bulk/reference.md#batch)
- [ผู้จัดทํา OpenAPI](https://flashdata.dev/docs/openapi.json)

<a id="webhooks"></a>

<a id="callbacks"></a>

## แจ้งเตือนการเติมให้สมบูรณ์

- [รับข้อมูลและตรวจสอบการเติมให้สมบูรณ์ของเว็บฮุค](https://flashdata.dev/th/docs/guides/async-batch/reference.md#webhooks)

<a id="troubleshooting"></a>

## การยิงปัญหา

- [ข้อผิดพลาดและรหัสสถานะ](https://flashdata.dev/th/docs/errors/reference.md#status-codes)
- [เมื่อต้องการลองใหม่](https://flashdata.dev/th/docs/errors/reference.md#retries)

## API ที่เกี่ยวข้อง

- [Google Search API](https://flashdata.dev/th/docs/sources/google_search/reference.md)
- [Google Images API](https://flashdata.dev/th/docs/sources/google_images/reference.md)
