Skip to content

按任务 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 路径传递。

参数类型说明
idstring任务唯一标识,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 数组。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求级状态码。
status_messagestring请求级状态信息。
timestring请求执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量。
tasks_errorintegertasks 数组中返回错误的任务数量。
tasksarray任务结果数组。

tasks 字段

字段类型说明
idstring任务唯一标识,UUID 格式。
status_codeinteger任务状态码,通常在 1000060000 范围。
status_messagestring任务状态信息。
timestring任务执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的结果数量。
patharray请求 URL 路径。
dataobject创建任务时提交的参数。
resultarray任务结果数组。

tasks[].data 常见字段

字段类型说明
se_typestring数据类型,例如 questions_and_answers
sestring搜索引擎,例如 google
apistringAPI 类型,例如 business_data
functionstring接口功能,例如 questions_and_answers
language_codestring语言代码。
location_namestring地理位置名称。
keywordstring查询或商家名称。
devicestring设备类型,例如 desktop
osstring操作系统,例如 windows

result 字段

字段类型说明
keywordstring创建任务时提交的。返回时会对 %## 进行解码,字符 + 会被解码为空格。如果创建任务时在 keyword 中提交了 cid,此字段将对应的 cid
se_domainstring创建任务时指定的搜索引擎域名。
location_codeinteger创建任务时指定的地理位置代码。
language_codestring创建任务时指定的语言代码。
check_urlstring搜索结果的直接 URL,可用于核验返回结果。
datetimestring获取结果的时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
cidstringGoogle 分给本地商家的唯一客户 ID。
feature_idstring搜索结果特征的唯一标识。
item_typesarray结果项类型数组,通常 google_business_question_item
items_without_answersarray没有回答的问题列表。
items_countintegeritems 数组中的数量。
itemsarray含回答的问题列表。

items_without_answers 字段

items_without_answers 中的每个均为类型为 google_business_question_item 的问题对象。

字段类型说明
typestring素类型,固定为 google_business_question_item
rank_groupinteger在相同 type素组中的位置。不同类型不会计此排名。
rank_absoluteinteger在结果中的绝对排名。
question_idstring问题 ID。
urlstring问题 URL。
profile_image_urlstring提问用户的头像 URL。
profile_urlstring提问用户的资料页 URL。
profile_namestring页面展示的用户名称。
question_textstring当前问题文本。
original_question_textstring原始问题文本;如果没有原始文本,则返回 null
time_agostring问题发布时间的相对时间,例如 3 years ago
timestampstring问题的准确发布时间。
itemsarray该问题下的子项,通常为空。

items 字段

items 中的每个均为回答的问题对象。

问题字段

字段类型说明
typestring素类型,固定为 google_business_question_item
rank_groupinteger在相同类型组中的位置。
rank_absoluteinteger在结果中的绝对排名。
question_idstring问题 ID。
urlstring问题 URL。
profile_image_urlstring提问用户的头像 URL。
profile_urlstring提问用户的资料页 URL。
profile_namestring页面展示的用户名称。
question_textstring当前问题文本。
original_question_textstring原始问题文本;如果没有原始文本,则返回 null
time_agostring问题发布时间的相对时间。
timestampstring问题的准确发布时间。
itemsarray当前问题下的回答列表。每个问题最多返回 5 条回答。

回答字段

items[].items 中的每个类型为 google_business_answer_element

字段类型说明
typestring素类型,固定为 google_business_answer_element
answer_idstring回答 ID。
profile_image_urlstring回答用户的头像 URL。
profile_urlstring回答用户的资料页 URL。
profile_namestring页面展示的用户名称。
answer_textstring当前回答文本。
original_answer_textstring原始回答文本;如果没有原始文本,则返回 null
time_agostring回答发布时间的相对时间。
timestampstring回答的准确发布时间。

响应示例

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 为空、resultnull 或任务状态码异常时,应用程序应记录错误并执行重试或人工处理逻辑。

建议客户端同时处理 HTTP 错误、顶层状态错误和单个任务错误,依据 HTTP 状态码判断业务是否成功。

实用场景

  • 汇总商家问答:集中获取多个商家资料中的问题与回答,识别用户最的服务、产品和到店规则,优化本地 SEO 页面。
  • 发现未回答问题:筛选 items_without_answers,及时定位尚未响应的潜在客户问题,降低商家资料页的信息缺口。
  • 提取用户需求:分析 question_textanswer_text,归纳用户对营业时间、库存、价格、设施等主题的度,支持 FAQ 和选题规划。
  • 监测本地竞争对手:按商家和地区定期抓取问答数据,比较不同商家的用户疑问与回复覆盖,发现本地搜索竞争机会。
  • 评估商家问答运营效果:结合问题发布时间、回答数量和回答时效,衡量商家对用户咨询的响应能力,为本地营销和客户服务改进提供依据。

统一入口:官网 · LLM API · 控制台