主题
Google 评论位置列表
接口说明
本接口用于获取 Google 评论支持的位置列表。支持获取位置,也可以按国家/地区筛选。
请求方法与路径:
http
GET https://api.seermartech.cn/v3/reviews/google/locations
GET https://api.seermartech.cn/v3/reviews/google/locations/{country},{country} 为国家/地区的 ISO 代码,例如 us。
当前使用本接口不收费。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
路径参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
country | string | 否 | 国家/地区 ISO 代码。填写后返回指定国家/地区的位置列表,例如 us。 |
请求示例
获取位置:
http
GET /v3/reviews/google/locations获取美国的位置:
http
GET /v3/reviews/google/locations/us响应说明
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求级状态码。20000 表示成功。完整状态码请参考错误码文档。 |
status_message | string | 请求级状态信息。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 子字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,采用 UUID 格式。 |
status_code | integer | 任务状态码,成功时通常为 20000。 |
status_message | string | 任务状态信息。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 本次请求对应的 URL 路径信息。 |
data | array | 请求中传的参数信息。 |
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
},20044 对应的上级位置可能为:
json
{
"location_code": 20044,
"location_name": "Lower Austria,Austria"
}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
api_url = "https://api.seermartech.cn/v3/reviews/google/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(api_url, headers=headers)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
"请求失败。状态码:%s,信息:%s"
% (result.get("status_code"), result.get("status_message"))
)按国家/地区筛选:
python
import requests
country = "us"
api_url = f"https://api.seermartech.cn/v3/reviews/google/locations/{country}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(api_url, headers=headers)
result = response.json()
if result.get("status_code") == 20000:
locations = result["tasks"][0].get("result", [])
for location in locations:
print(location)
else:
print(result)TypeScript 示例
typescript
import axios from "axios";
async function getGoogleReviewLocations(country?: string) {
const path = country
? `/v3/reviews/google/locations/${country}`
: "/v3/reviews/google/locations";
const response = await axios.get(
`https://api.seermartech.cn${path}`,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
const result = response.data;
if (result.status_code === 20000) {
return result;
}
throw new Error(
`请求失败。状态码:${result.status_code},信息:${result.status_message}`
);
}
getGoogleReviewLocations("us")
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(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": [
{
"id": "00000000-0000-0000-0000-000000000000",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1234 sec.",
"cost": 0,
"result_count": 2,
"path": [
"v3",
"reviews",
"google",
"locations"
],
"data": {
"api": "reviews",
"function": "locations",
"se": "google"
},
"result": [
{
"location_code": 20044,
"location_name": "Lower Austria,Austria",
"location_code_parent": 20000,
"country_iso_code": "AT",
"location_type": "province"
},
{
"location_code": 9041134,
"location_name": "Vienna International Airport,Lower Austria,Austria",
"location_code_parent": 20044,
"country_iso_code": "AT",
"location_type": "airport"
}
]
}
]
}实用场景
- 构建国家/地区筛选器:获取可用的位置代码,为 Google 评论采集、排名监控或门店分析提供标准化地域选项。
- 匹位置层级:利用
location_code_parent建立国家、省州、城市及地点的层级结构,支持区域汇总与下钻分析。 - 校验用户的位置:根据
location_code和country_iso_code校验业务系统中的国家、地区或地点参数,减少无效请求。 - 生成本地 SEO置:将位置名称和代码写项目,批量创建不同地区的 Google 评论监控任务。
- 维护地域数据字:定期同步位置列表,为门店管理、区域报表和多地区 SEO 项目提供统一的位置主数据。