主题
Google Ads Search 地域列表
GET /v3/serp/google/ads_search/locations
接口说明
用于获取 SERP API 中 google/ads_search 支持的地域列表。
- 请求方式:
GET - 请求地址:
https://api.seermartech.cn/v3/serp/google/ads_search/locations - 计费:,不会产生接口费用
说明:由于平台服务策略限制,俄罗斯与白俄罗斯的所有地域目前均不再支持。
接口返回 JSON 数据,顶层 tasks 数组,每个任务中本次请求的执行信息与地域列表结果。
请求信息
HTTP Request
GET /v3/serp/google/ads_search/locations
请求头
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json响应结构
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 接口总体状态码,完整列表参考 /v3/appendix/errors |
status_message | string | 接口总体状态信息,完整列表参考 /v3/appendix/errors |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位;本接口通常为 0,扣费以响应头 X-SeerMarTech-Charge-CNY 为准 |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | 返回错误的任务数量 |
tasks | array | 任务结果数组 |
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000,完整列表参考 /v3/appendix/errors |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时,单位秒 |
cost | float | 当前任务费用,单位 |
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:20044对应的上级地域:
location_code:20044location_name:Lower Austria,Austria
这表示该机场地域从属于 “Lower Austria, Austria”。
代码示例
cURL
bash
curl --location --request GET "https://api.seermartech.cn/v3/serp/google/ads_search/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/ads_search/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
data = response.json
if data.get("status_code") == 20000:
print(data)
else:
print(f'error. Code: {data.get("status_code")} Message: {data.get("status_message")}')TypeScript
typescript
import axios from "axios";
// 获取 Google Ads Search 支持的地域列表
axios({
method: "get",
url: "https://api.seermartech.cn/v3/serp/google/ads_search/locations",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
})
.then(function (response) {
// 返回结果
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});响应示例
json
{
"version": "0.1.20241101",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0715 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "serp",
"function": "locations",
"se": "google",
"se_type": "ads_search"
},
"result": []
}
]
}状态码说明
20000:请求成功- 状态码:表示请求或任务执行异常,完整列表参考
/v3/appendix/errors
使用建议
获取地域列表后,建议将以下字段缓存到本地或数据库中,便于后续发起 SERP 任务时复用:
location_codelocation_namelocation_code_parentcountry_iso_codelocation_type
如果你需要按国家、州、省、城市或机场等层级构建地域选择器,location_code_parent 可用于还原地域树结构。
实用场景
- 构建投放地域选择器:拉取支持的地域列表并按国家、地区、城市分层展示,提升广告监测任务效率。
- 校验地域参数:在创建 SERP 广告搜索任务前校验
location_code是否有效,减少因参数错误导致的请求失败。 - 建立地域映射表:将平台地域编码与 CRM、BI 或投放系统中的地域维度做映射,便于统一分析。
- 还原地域层级:利用
location_code_parent构建“国家 - 州/省 - 城市 - 特殊地点”树状结构,支持精细化地域分析。 - 过滤不可用市场:同步最新支持地域,自动排除当前不再支持的国家或地区,降低业务风险。