主题
Google 评论支持地区列表
接口概述
该接口用于获取 Google 评论数据支持的地区列表。
你可以通过以下方式调用:
- 获取支持地区:
GET /v3/reviews/google/locations - 按国家筛选地区:
GET /v3/reviews/google/locations/$country
当你在后续评论任务中需要设置地区参数时,可通过本接口查询可用地区列表。
计费说明
本接口不收费。
参考价约 ¥0.0000 / 次 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求地址
text
GET https://api.seermartech.cn/v3/reviews/google/locations
GET https://api.seermartech.cn/v3/reviews/google/locations/{country}路径参数
| 参数名 | 类型 | 填 | 说明 |
|---|---|---|---|
country | string | 否 | 国家 ISO 代码。传后返回该国家下的支持地区。例如:us |
返回结果说明
接口返回 JSON 数据,顶层 tasks 数组,每个任务对象结果。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,完整列表参考 /v3/appendix/errors |
status_message | string | 通用状态信息,完整列表参考 /v3/appendix/errors |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | tasks 数组中返回错误的任务数量 |
tasks | array | 任务结果数组 |
tasks 对象字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000,完整列表参考 /v3/appendix/errors |
status_message | string | 任务状态说明 |
time | string | 任务执行耗时,单位秒 |
cost | float | 该任务费用,单位 USD |
result_count | integer | result 数组中的数量 |
path | array | 请求 URL 路径 |
data | array | GET 请求 URL 中传的参数 |
result | array | 返回的地区列表 |
result 数组字段
| 字段名 | 类型 | 说明 |
|---|---|---|
location_code | integer | 地区编码 |
location_name | string | 地区名 |
location_code_parent | integer | 上级地区编码 |
country_iso_code | string | 地区所属国家的 ISO 代码 |
location_type | string | 地区类型 |
地区层级说明
location_code_parent 表示当前地区的上级行政或地理节点。例如:
json
{
"location_code": 9041134,
"location_name": "Vienna International Airport,Lower Austria,Austria",
"location_code_parent": 20044
}说明:
json
{
"location_code": 20044,
"location_name": "Lower Austria,Austria"
}表示 9041134 对应的上级地区是 Lower Austria,Austria。
认证方式
请在请求头中使用 Bearer Token:
http
Authorization: Bearer smt_live_YOUR_KEY请求示例
cURL
bash
curl --location --request GET "https://api.seermartech.cn/v3/reviews/google/locations" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"按国家筛选示例:
bash
curl --location --request GET "https://api.seermartech.cn/v3/reviews/google/locations/us" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
url = "https://api.seermartech.cn/v3/reviews/google/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
result = response.json
if result.get("status_code") == 20000:
print(result)
else:
print(f'error. Code: {result.get("status_code")} Message: {result.get("status_message")}')TypeScript
typescript
import axios from "axios";
axios({
method: "get",
url: "https://api.seermartech.cn/v3/reviews/google/locations",
headers: {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
})
.then((response) => {
// 返回结果
console.log(response.data);
})
.catch((error) => {
console.log(error);
});响应示例
json
{
"version": "0.1.20200325",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.4416 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "reviews",
"function": "locations",
"se": "google"
},
"result": []
}
]
}状态码说明
你可以通过以下字段判断请求是否成功:
- 顶层
status_code tasks[].status_code
常见判断方式:
20000:请求成功- 状态码:表示请求或任务处理异常
完整错误码与状态信息请参考 /v3/appendix/errors。
使用建议
- 在创建 Google 评论采集任务前,调用本接口确认目标地区是否受支持。
- 如果业务只特定国家,建议通过
/{country}方式缩小返回范围,减少本地筛选成本。 - 将
location_code持化到本地或数据库中,可直接用于后续任务构建。 - 若需要维护地区树结构,可结合
location_code_parent构建父子层级。
实用场景
- 校验投放地区:在创建 Google 评论采集任务前验证地区是否受支持,减少因地区参数错误导致的任务失败。
- 构建地区选择器:将返回的
location_name、location_code和父级生成前端下拉或级联选择组件,提升运营效率。 - 维护地区映射表:把平台城市、机场、州省与本接口返回的标准
location_code对齐,便于批量任务自动化处理。 - 按国家批量初始化:按
country拉取目标国家地区,再批量建立本地索引,为评论监控系统做准备。 - 建立地理层级分析:利用
location_code_parent组地区树,用于后续按国家、省州、城市等维度汇总评论数据。