主题
按任务 ID 获取 Google 商家问答结果
本接口使用 GET 方法,通过任务 ID 获取 Google 商家资料中的问题与回答结果。
接口路径:
text
GET https://api.seermartech.cn/v3/business_data/google/questions_and_answers/task_get/$id接口返回指定商家实体的问题和回答问题与回答的完整文本、发布时间、用户资料及数据。
计费说明
任务创建成功后会产生费用。任务结果可在创建后的 30 天重复获取,获取结果本身不额外收费。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
请求无需请求体,任务 ID 通过 URL 路径传递。
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。任务创建后可在 30 天使用该 ID 获取结果。 |
请求示例
curl
bash
curl --location --request GET \
"https://api.seermartech.cn/v3/business_data/google/questions_and_answers/task_get/04261229-1535-0577-0000-e3c2f0a46daf" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
task_id = "09151804-0696-0242-1000-94020b2b7bf5"
url = (
"https://api.seermartech.cn/v3/business_data/google/"
f"questions_and_answers/task_get/{task_id}"
)
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
if data.get("status_code") == 20000:
print(data)
else:
print(
f"请求失败,错误码:{data.get('status_code')},"
f"错误信息:{data.get('status_message')}"
)TypeScript
typescript
const taskId = "09151609-0696-0242-0000-e54466d0bdb2";
const response = await fetch(
`https://api.seermartech.cn/v3/business_data/google/questions_and_answers/task_get/${taskId}`,
{
method: "GET",
headers: {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
const result = await response.json();
if (result.status_code === 20000) {
console.log(result);
} else {
console.error(
`请求失败,错误码:${result.status_code},错误信息:${result.status_message}`
);
}沙盒测试
可使用以下沙盒任务 ID 获取模拟结果:
text
https://api.seermartech.cn/v3/business_data/google/questions_and_answers/task_get/00000000-0000-0000-0000-000000000000沙盒响应该接口支持的字段,但字段值为模拟数据。使用沙盒接口不会产生费用。
响应结构
接口返回 JSON 数据,顶层 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
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 | 创建任务时提交的参数。 |
result | array | 任务结果数组。 |
tasks[].data 常见字段
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 数据类型,例如 questions_and_answers。 |
se | string | 搜索引擎,例如 google。 |
api | string | API 类型,例如 business_data。 |
function | string | 接口功能,例如 questions_and_answers。 |
language_code | string | 语言代码。 |
location_name | string | 地理位置名称。 |
keyword | string | 查询或商家名称。 |
device | string | 设备类型,例如 desktop。 |
os | string | 操作系统,例如 windows。 |
result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时提交的。返回时会对 %## 进行解码,字符 + 会被解码为空格。如果创建任务时在 keyword 中提交了 cid,此字段将对应的 cid。 |
se_domain | string | 创建任务时指定的搜索引擎域名。 |
location_code | integer | 创建任务时指定的地理位置代码。 |
language_code | string | 创建任务时指定的语言代码。 |
check_url | string | 搜索结果的直接 URL,可用于核验返回结果。 |
datetime | string | 获取结果的时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
cid | string | Google 分给本地商家的唯一客户 ID。 |
feature_id | string | 搜索结果特征的唯一标识。 |
item_types | array | 结果项类型数组,通常 google_business_question_item。 |
items_without_answers | array | 没有回答的问题列表。 |
items_count | integer | items 数组中的数量。 |
items | array | 含回答的问题列表。 |
items_without_answers 字段
items_without_answers 中的每个均为类型为 google_business_question_item 的问题对象。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 google_business_question_item。 |
rank_group | integer | 在相同 type素组中的位置。不同类型不会计此排名。 |
rank_absolute | integer | 在结果中的绝对排名。 |
question_id | string | 问题 ID。 |
url | string | 问题 URL。 |
profile_image_url | string | 提问用户的头像 URL。 |
profile_url | string | 提问用户的资料页 URL。 |
profile_name | string | 页面展示的用户名称。 |
question_text | string | 当前问题文本。 |
original_question_text | string | 原始问题文本;如果没有原始文本,则返回 null。 |
time_ago | string | 问题发布时间的相对时间,例如 3 years ago。 |
timestamp | string | 问题的准确发布时间。 |
items | array | 该问题下的子项,通常为空。 |
items 字段
items 中的每个均为回答的问题对象。
问题字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 google_business_question_item。 |
rank_group | integer | 在相同类型组中的位置。 |
rank_absolute | integer | 在结果中的绝对排名。 |
question_id | string | 问题 ID。 |
url | string | 问题 URL。 |
profile_image_url | string | 提问用户的头像 URL。 |
profile_url | string | 提问用户的资料页 URL。 |
profile_name | string | 页面展示的用户名称。 |
question_text | string | 当前问题文本。 |
original_question_text | string | 原始问题文本;如果没有原始文本,则返回 null。 |
time_ago | string | 问题发布时间的相对时间。 |
timestamp | string | 问题的准确发布时间。 |
items | array | 当前问题下的回答列表。每个问题最多返回 5 条回答。 |
回答字段
items[].items 中的每个类型为 google_business_answer_element。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 google_business_answer_element。 |
answer_id | string | 回答 ID。 |
profile_image_url | string | 回答用户的头像 URL。 |
profile_url | string | 回答用户的资料页 URL。 |
profile_name | string | 页面展示的用户名称。 |
answer_text | string | 当前回答文本。 |
original_answer_text | string | 原始回答文本;如果没有原始文本,则返回 null。 |
time_ago | string | 回答发布时间的相对时间。 |
timestamp | string | 回答的准确发布时间。 |
响应示例
json
{
"version": "0.1.20240422",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1082 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "04261229-1535-0577-0000-e3c2f0a46daf",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1021 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"business_data",
"google",
"questions_and_answers",
"task_get",
"04261229-1535-0577-0000-e3c2f0a46daf"
],
"data": {
"se_type": "questions_and_answers",
"se": "google",
"api": "business_data",
"function": "questions_and_answers",
"language_code": "en",
"location_name": "Los Angeles,California,United States",
"keyword": "The Last Bookstore",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "The Last Bookstore",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?q=The+Last+Bookstore",
"datetime": "2024-04-26 09:29:33 +00:00",
"cid": "8591a1380838a935",
"feature_id": "questions_and_answers",
"item_types": [
"google_business_question_item"
],
"items_without_answers": [],
"items_count": 1,
"items": [
{
"type": "google_business_question_item",
"rank_group": 1,
"rank_absolute": 1,
"question_id": "8@1:CAESGUNWX0I0cUFQSFFOMXc5aXBJVkdBQUZwMGc|",
"url": "https://www.google.com/maps/place/data=!4m5",
"profile_image_url": "https://lh3.googleusercontent.com/a/example=s120-c-rp-mo",
"profile_url": "https://www.google.com/maps/contrib/106548099572226128293",
"profile_name": "Charles Kang",
"question_text": "Do you still trade used books?",
"original_question_text": null,
"time_ago": "3 years ago",
"timestamp": "2021-04-26 09:29:33 +00:00",
"items": [
{
"type": "google_business_answer_element",
"answer_id": "answer-123456",
"profile_image_url": "https://lh3.googleusercontent.com/a/example=s120-c-rp-mo",
"profile_url": "https://www.google.com/maps/contrib/123456789",
"profile_name": "商家用户",
"answer_text": "Yes, we accept used books.",
"original_answer_text": null,
"time_ago": "3 years ago",
"timestamp": "2021-04-27 10:15:00 +00:00"
}
]
}
]
}
]
}
]
}状态码与错误处理
请根据顶层 status_code 和任务级 tasks[].status_code 判断请求是否成功:
20000:请求或任务执行成功。40000及以上:任务执行失败或返回错误,应结合status_message排查原因。- 当
tasks为空、result为null或任务状态码异常时,应用程序应记录错误并执行重试或人工处理逻辑。
建议客户端同时处理 HTTP 错误、顶层状态错误和单个任务错误,依据 HTTP 状态码判断业务是否成功。
实用场景
- 汇总商家问答:集中获取多个商家资料中的问题与回答,识别用户最的服务、产品和到店规则,优化本地 SEO 页面。
- 发现未回答问题:筛选
items_without_answers,及时定位尚未响应的潜在客户问题,降低商家资料页的信息缺口。 - 提取用户需求:分析
question_text和answer_text,归纳用户对营业时间、库存、价格、设施等主题的度,支持 FAQ 和选题规划。 - 监测本地竞争对手:按商家和地区定期抓取问答数据,比较不同商家的用户疑问与回复覆盖,发现本地搜索竞争机会。
- 评估商家问答运营效果:结合问题发布时间、回答数量和回答时效,衡量商家对用户咨询的响应能力,为本地营销和客户服务改进提供依据。