主题
business_data/google/languages:获取 Google Business Data 支持的语言
GET /v3/business_data/google/languages
本接口使用 GET 方法,请求路径为:
GET https://api.seermartech.cn/v3/business_data/google/languages
用于获取 Google Business Data API 支持的语言列表。接口返回 JSON 数据 tasks 数组及对应的语言信息。
计费说明
当前调用本接口不计费,接口返回的 cost 通常为 0。如响应中计费信息,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求方式
本接口无需请求体。
认证方式
请求头中使用以下认证信息:
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json响应字段
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 请求的通用状态码 |
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 | 任务状态码,取值范围为 10000-60000 |
status_message | string | 任务处理结果的提示信息 |
time | string | 任务执行耗时,单位为秒 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量 |
path | array | 请求 URL 路径 |
data | object | 请求 URL 中传递的参数 |
result | array | 语言列表结果 |
result 对象字段
| 字段 | 类型 | 说明 |
|---|---|---|
language_name | string | 语言名称 |
language_code | string | 按 ISO 639-1 标准定义的语言代码 |
请求示例
cURL
bash
curl --location --request GET \
"https://api.seermartech.cn/v3/business_data/google/languages" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"PHP
php
<?php
require('RestClient.php');
$api_url = 'https://api.seermartech.cn/';
$client = new RestClient($api_url, null, 'smt_live_YOUR_KEY', '');
try {
// 获取 Google Business Data API 支持的语言列表
// GET /v3/business_data/google/languages
$result = $client->get('/v3/business_data/google/languages');
print_r($result);
} catch (RestClientException $e) {
echo "\n";
print "HTTP code: {$e->getHttpCode()}\n";
print "Error code: {$e->getCode()}\n";
print "Message: {$e->getMessage()}\n";
print $e->getTraceAsString();
echo "\n";
}
$client = null;
?>TypeScript
typescript
import axios from "axios";
axios({
method: "get",
url: "https://api.seermartech.cn/v3/business_data/google/languages",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
})
.then((response) => {
// 处理响应数据
console.log(response.data);
})
.catch((error) => {
console.error(error.response?.data || error.message);
});Python
python
import requests
url = "https://api.seermartech.cn/v3/business_data/google/languages"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
"请求失败。错误码:%s,错误信息:%s"
% (result.get("status_code"), result.get("status_message"))
)
else:
print("HTTP 请求失败:%s" % response.status_code)C#
csharp
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
namespace SeerMarTechDemos
{
public static class Demos
{
public static async Task GetBusinessDataLanguages()
{
using var httpClient = new HttpClient
{
BaseAddress = new Uri("https://api.seermartech.cn/")
};
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "smt_live_YOUR_KEY");
// 获取 Google Business Data API 支持的语言列表
// GET /v3/business_data/google/languages
var response = await httpClient.GetAsync(
"/v3/business_data/google/languages"
);
var responseText = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<dynamic>(responseText);
if ((int)result.status_code == 20000)
{
Console.WriteLine(responseText);
}
else
{
Console.WriteLine(
$"请求失败。错误码:{result.status_code},错误信息:{result.status_message}"
);
}
}
}
}响应示例
json
{
"version": "0.1.20200909",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0779 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "2f1c3c8e-8d6a-4c48-9f65-0e7c1f1b9a20",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0501 sec.",
"cost": 0,
"result_count": 3,
"path": [
"v3",
"business_data",
"google",
"languages"
],
"data": {
"api": "business_data",
"function": "languages",
"se": "google"
},
"result": [
{
"language_name": "English",
"language_code": "en"
},
{
"language_name": "Chinese",
"language_code": "zh"
},
{
"language_name": "Japanese",
"language_code": "ja"
}
]
}
]
}状态码说明
| 状态码字段 | 说明 |
|---|---|
顶层 status_code | 表示整个请求的处理状态 |
任务级 tasks[].status_code | 表示单个任务的处理状态 |
20000 | 请求成功 |
10000-60000 | 任务状态码可能处于此范围,含义以接口错误码说明为准 |
实用场景
- 获取可用语言代码:在创建或查询 Google Business Data 任务前校验语言参数,因语言代码不受支持导致任务失败。
- 构建语言选择器:将
language_name和language_code转换为后台或前端下拉选项,支持多语言 SEO 运营流程。 - 初始化本地化:在 SEO 平台首次接时同步支持的语言列表,为不同国家或地区的商家数据分析建立基础。
- 校验批量任务参数:对批量采集任务中的语言代码进行预检查,减少无效请求并提高任务成功率。