主题
数据地点列表(keywords_data/locations)
接口概述
该接口用于获取数据可用的地理位置列表,基于 Google 地理定向体系。创建任务时,可使用 Google 支持的大多数地点类型,Okrug 类型除外。
支持的请求路径:
GET /v3/keywords_data/wp/locationsGET /v3/keywords_data/wp/locations/$country
说明:
- 不带
$country时,返回可用地点 - 带
$country时,可按国家过滤地点列表
说明:
- 邮政编码可用于创建任务,但对应任务的 API 响应通常不会返回数据。
- 俄罗斯与白俄罗斯的地点当前不再受支持。
请求地址
bash
GET https://api.seermartech.cn/v3/keywords_data/wp/locations
GET https://api.seermartech.cn/v3/keywords_data/wp/locations/$country计费说明
调用该接口不收费。
可理解为:
- 参考价约 ¥0.0000 / 次
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准
功能说明
通过本接口,你可以:
- 获取数据支持的地点列表
- 在建任务前按国家筛选地点
- 为后续查询、搜索量分析、趋势分析等接口准备
location_code
如需完整地点单,也可使用平台提供的 CSV 地点数据文件进行本地管理;使用时建议以接口返回结果为准。
路径参数
$country
按国家过滤地点列表时使用。一般传国家标识后返回该国家下可用的地点集合。
响应结构
接口返回 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 | 任务状态说明,完整列表见 /v3/appendix-errors/ |
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 | 地点类型,取值遵循 Google 地理定向类型定义 |
上级地点示例
例如:
当前地点:
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/keywords_data/wp/locations" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
url = "https://api.seermartech.cn/v3/keywords_data/wp/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/keywords_data/wp/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": "keywords_data",
"function": "locations",
"se": "wp"
},
"result": []
}
]
}错误码说明
可重点以下字段:
- 顶层
status_code:请求整体状态 - 顶层
status_message:请求整体状态说明 tasks[].status_code:单个任务状态tasks[].status_message:单个任务状态说明
完整错误码与状态说明请参考容路径:
/v3/appendix/errors/v3/appendix-errors/
通常当 status_code = 20000 时表示请求成功。
使用建议
- 在创建数据任务前,通过本接口确认可用
location_code - 若你的业务某一国家,优使用带
$country的路径以减少本地筛选成本 - 保存
location_code与location_name的映射,便于前端下拉框、投放区域选择器或报表维度统一 - 若使用邮政编码做定向,请注意后续结果接口可能不会返回对应数据
实用场景
- 预加载地点字:拉取支持地点并建立本地映射表,便于查询页面快速选择地区并减少人工录错误。
- 按国家构建区域筛选器:获取指定国家的地点列表,为 SEO 团队提供国家、省州、城市等分层筛选能力,提升任务效率。
- 校验投放区域参数:在提交搜索量或趋势任务前,验证
location_code是否有效,因地区参数错误导致任务失败。 - 统一多接口地区编码:将本接口返回的地点编码作为标准地区主数据,确保搜索量、竞品、排名等分析使用一致的地理维度。
- 分析本地化 SEO 机会:按城市、州、省等地点类型建立区域库,识别更适合本地化布局和页面优化的市场。