Skip to content

获取 Google My Business Info 已完成任务

GET /v3/business_data/google/my_business_info/tasks_ready

本接口使用 GET 方法,路径为:

/v3/business_data/google/my_business_info/tasks_ready

用于获取已完成但尚未领取结果的 Google My Business Info 任务列表。获取任务 ID 后,可通过对应的任务结果接口领取数据。

如果创建任务时未设置 postback_url,可通过本接口轮询已完成任务。对于高并发场景,建议优使用回调机制;本接口更适合用于补偿查询未成功回调的任务。

> 注意:由于完成任务队列存在少量更新延迟,本接口不适合每分钟领取 1000 个任务的高吞吐场景。

请求地址

http
GET https://api.seermartech.cn/v3/business_data/google/my_business_info/tasks_ready

也可以使用以下通用路径:

http
GET https://api.seermartech.cn/v3/business_data/$se/tasks_ready

$se 为搜索引擎名称。

获取 Business Data API 下所有已完成任务:

http
GET https://api.seermartech.cn/v3/business_data/tasks_ready

计费与调用限制

  • 获取已完成任务列表不产生额外费用。
  • 每个已完成任务会一直保留在列表中,直到被领取。
  • 每分钟最多调用 20 次。
  • 每次调用最多返回过去 3 天完成的 1000 个任务。
  • 已经领取过的任务不会再次出现在列表中。
  • 完成后 3 天仍未领取的任务不会出现在列表中。
  • 如果任务设置了 postback_url,正常该任务不会出现在本列表中。
  • 只有当向回调地址发送请求失败,且服务端返回的 HTTP 状态码小于 200 或大于 300 时,该任务才可能出现在列表中。

请求参数

本接口无需请求参数,也无需请求体。

请求头

http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json

响应结构

接口返回 JSON 数据,顶层 tasks 数组。

顶层字段

字段类型说明
versionstring当前 API 版本
status_codeinteger接口整体状态码,完整错误码请参考 /v3/appendix/errors
status_messagestring接口整体提示信息
timestring接口执行耗时,单位为秒
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量
tasks_errorintegertasks 数组中返回错误的任务数量
tasksarray已完成任务列表

tasks 数组字段

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

result 数组字段

字段类型说明
idstring已完成任务的唯一标识,UUID 格式
sestring创建任务时指定的搜索引擎,目前为 google
se_typestring搜索引擎类型,通常为 my_business_info
date_postedstring任务提交时间,使用 UTC 时间格式
tagstring用户自定义任务标识
endpointstring用于领取该任务结果的接口地址

请求示例

cURL

bash
curl --location --request GET \
  "https://api.seermartech.cn/v3/business_data/google/my_business_info/tasks_ready" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json"

PHP

php
<?php

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://api.seermartech.cn/v3/business_data/google/my_business_info/tasks_ready',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer smt_live_YOUR_KEY',
        'Content-Type: application/json',
    ],
]);

$response = curl_exec($ch);

if ($response === false) {
    echo '请求失败:' . curl_error($ch);
} else {
    $result = json_decode($response, true);
    print_r($result);
}

curl_close($ch);

TypeScript

typescript
import axios from "axios";

axios
  .get(
    "https://api.seermartech.cn/v3/business_data/google/my_business_info/tasks_ready",
    {
      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/my_business_info/tasks_ready"

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()
    print(result)
else:
    print(f"HTTP 请求失败:{response.status_code}")
    print(response.text)

C#

csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

public class Demo
{
    public static async Task GetTasksReadyAsync()
    {
        using var httpClient = new HttpClient();

        httpClient.DefaultRequestHeaders.Authorization =
            new AuthenticationHeaderValue("Bearer", "smt_live_YOUR_KEY");

        var response = await httpClient.GetAsync(
            "https://api.seermartech.cn/v3/business_data/google/my_business_info/tasks_ready"
        );

        var content = await response.Content.ReadAsStringAsync();

        if (response.IsSuccessStatusCode)
        {
            // 处理接口返回结果
            Console.WriteLine(content);
        }
        else
        {
            Console.WriteLine($"请求失败:{(int)response.StatusCode}");
            Console.WriteLine(content);
        }
    }
}

响应示例

json
{
  "version": "0.1.20200909",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.2261 sec.",
  "cost": 0,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "0727a7b3-1e7d-4f0d-9c9f-123456789abc",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "0.1200 sec.",
      "cost": 0,
      "result_count": 1,
      "path": [
        "/v3/business_data/google/my_business_info/task_get/0727a7b3-1e7d-4f0d-9c9f-123456789abc"
      ],
      "data": {
        "se_type": "my_business_info",
        "se": "google",
        "api": "business_data",
        "function": "my_business_info"
      },
      "result": [
        {
          "id": "0727a7b3-1e7d-4f0d-9c9f-123456789abc",
          "se": "google",
          "se_type": "my_business_info",
          "date_posted": "2024-01-15 08:30:00 +00:00",
          "tag": "store-check-001",
          "endpoint": "/v3/business_data/google/my_business_info/task_get/0727a7b3-1e7d-4f0d-9c9f-123456789abc"
        }
      ]
    }
  ]
}

获取到任务 ID 后,可根据响应中的 endpoint 字段调用任务结果接口,领取该任务的详细数据。

状态码与异常处理

  • 当顶层 status_code20000 时,表示请求成功。
  • 应用程序应同时检查 tasks_error 以及每个任务对象中的 status_code
  • 建议对接口异常、任务失败、结果领取时以及回调失败进行重试或补偿处理。
  • 完整状态码和错误信息请参考 /v3/appendix/errors

实用场景

  • 轮询已完成的门店信息任务:定期获取已完成的 Google 商家信息采集任务,及时更新本地门店数据库。
  • 补偿回调失败任务:筛选未成功推送到业务服务器的任务 ID,门店数据因回调异常而遗漏。
  • 构建任务调度队列:根据已完成任务列表触发后续结果领取、洗和库流程,提高异步采集系统的稳定性。
  • 监控批量采集进度:统计已完成任务数量和失败数量,评估批量商家数据采集任务的执行。
  • 对接多搜索引擎任务管理:使用通用 /v3/business_data/$se/tasks_ready 路径统一管理不同搜索引擎下的 Business Data API 任务。

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