主题
Bing 数据支持地区列表
GET /v3/keywords_data/bing/locations
接口说明
该接口用于获取 Bing Ads API 在数据场景下支持的地区列表。
调用后,接口会返回可用地区的完整单,适合用于构建地域选择器、校验 location_code 参数,或在批量任务前同步地区数据。
注意:由于平台政策限制,俄罗斯和白俄罗斯的所有地区目前不再受支持。
另请注意,/v3/keywords_data/bing/keyword_performance/live/ 接口使用的是另一套地区与语言列表,不应与本接口返回结果混用;如需查询该接口的适用地区与语言,应使用对应的专用接口。
请求方式
GET https://api.seermartech.cn/v3/keywords_data/bing/locations
计费说明
本接口,不产生扣费。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准;本接口通常返回 0。
响应结构
接口返回 JSON 数据,顶层 tasks 数组,每个任务中给出可用地区列表。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 接口整体状态码 |
status_message | string | 接口整体状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | tasks 数组中返回错误的任务数量 |
tasks | array | 任务数组 |
tasks[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态说明 |
time | string | 任务执行耗时,单位秒 |
cost | float | 当前任务费用,单位 USD |
result_count | integer | result 数组中的结果数量 |
path | array | 请求路径 |
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_parent 说明
location_code_parent 表示当前地区所属的上级行政区域或父级地域。
示例:
当前地区:
location_code:9041134location_name:Vienna International Airport,Lower Austria,Austrialocation_code_parent:20044父级地区
20044对应:location_code:20044location_name:Lower Austria,Austria
认证方式
请求头统一使用 Bearer Token:
bash
Authorization: Bearer smt_live_YOUR_KEY请求示例
cURL
bash
curl --location --request GET "https://api.seermartech.cn/v3/keywords_data/bing/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/bing/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
# 获取 Bing 数据支持的地区列表
response = requests.get(url, headers=headers)
# 输出响应结果
print(response.status_code)
print(response.json)TypeScript
typescript
import axios from "axios";
// 获取 Bing 数据支持的地区列表
axios({
method: "get",
url: "https://api.seermartech.cn/v3/keywords_data/bing/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": "0.1.20201021",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2425 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "keywords_data",
"function": "locations",
"se": "bing"
},
"result": []
}
]
}状态码说明
| 状态码 | 说明 |
|---|---|
20000 | 请求成功 |
10000-60000 | 任务级状态码范围,表示不同执行状态或错误 |
完整错误码与状态说明请参考 /v3/appendix/errors。
使用说明
- 本接口返回 Bing 数据可用的地区数据。
- 返回结果可作为接口中的
location_code参数来源。 - 如果你的业务涉及
/v3/keywords_data/bing/keyword_performance/live/,请不要直接使用本接口结果作为地区依据。 - 建议定期同步地区列表,以应对平台支持范围变更。
实用场景
- 构建地区选择器:将返回的
location_name与location_code用于前端下拉框,减少手工维护地区枚举的成本。 - 校验投放地域参数:在提交查询或广告任务前,校验
location_code是否有效,降低无效请求率。 - 维护地区映射表:基于
location_code_parent建立父子层级,支持国家、省州、城市等多级地域筛选。 - 同步地区支持范围:定期拉取最新地区列表,及时发现被移除或新增的区域,保证业务与平台一致。
- 规范多数据源地域编码:将本接口返回的标准编码统一纳数据字,提升报表、分析和任务调度的一致性。