主题
Google Events 可用地域列表
接口说明
该接口用于获取 Google Events SERP API 支持的地域列表。
请求方式
GET https://api.seermartech.cn/v3/serp/google/events/locations
计费说明
调用本接口不会产生费用。 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
功能说明
通过本接口可以返回当前支持的地域单:
- 地域编码
location_code - 地域名称
location_name - 上级地域编码
location_code_parent - 国家 ISO 编码
country_iso_code - 地域类型
location_type
如需完整地域列表,也可使用平台提供的地域数据文件。
注意事项
由于平台服务策略调整,俄罗斯和白俄罗斯的所有地域目前不在支持范围。
响应结构
接口返回 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 | object | 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:9041134location_name:Vienna International Airport,Lower Austria,Austrialocation_code_parent:20044location_code_parent = 20044对应的上级地域为:location_code:20044location_name:Lower Austria,Austria
请求示例
cURL
bash
curl --location --request GET "https://api.seermartech.cn/v3/serp/google/events/locations" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
url = "https://api.seermartech.cn/v3/serp/google/events/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
result = response.json
print(result)TypeScript
typescript
import axios from "axios";
axios({
method: "get",
url: "https://api.seermartech.cn/v3/serp/google/events/locations",
headers: {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
})
.then((response) => {
// 返回结果
console.log(response.data);
})
.catch((error) => {
console.error(error);
});响应示例
json
{
"version": "3.20191128",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.4305 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "serp",
"function": "locations",
"se": "google",
"se_type": "events"
},
"result": []
}
]
}状态码说明
可通过 /v3/appendix/errors 查看完整错误码与状态信息。常见判断方式如下:
- 顶层
status_code = 20000:请求成功 - 任务级
tasks[].status_code = 20000:任务执行成功 - 状态码:表示请求或任务存在错误,应结合
status_message排查
使用建议
在提交 Google Events 查询任务前,建议通过本接口确认目标地域是否受支持,并缓存地域映射,以减少无效请求。
实用场景
- 校验投放地域:在创建 Google Events 抓取任务前检查地域是否可用,因地域不支持导致任务失败。
- 构建地域选择器:将返回的地域编码与名称用于后台界面,方便运营人员快速选择目标城市、州或机场等地域。
- 维护地域映射表:定期同步最新地域列表,建立
location_code与地区字的对应,提升数据处理一致性。 - 筛除失效地区:识别已不再支持的国家或地区,提前在业务流程中拦截,减少无效调用。
- 支持多层级分析:利用
location_code_parent建立地域层级结构,便于后续按国家、省州、城市等维度汇总活动搜索数据。