Skip to content

Webhook 重发

POST /v3/appendix/webhook_resend

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

/v3/appendix/webhook_resend

用于为最多 100 个指定任务重新发送 Webhook Pingback 和 Postback。重新发送不会重复扣除任务费用。

计费说明

调用本接口不产生额外费用,响应中的 cost 通常为 0。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求

请求地址

text
POST https://api.seermartech.cn/v3/appendix/webhook_resend

请求体使用 UTF-8 编码的 JSON 数组。每个任务标识符作为数组中的独立对象传,单次最多支持 100 个任务。

请求头

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

请求参数

字段类型说明
idstring任务唯一标识符,为 UUID 格式。每个请求最多传 100 个任务 ID。

请求示例

curl

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/appendix/webhook_resend" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "id": "08161139-0001-0066-1000-06491d097ed5"
    },
    {
      "id": "08161340-0001-0066-1000-8b091c84af4f"
    },
    {
      "id": "08161703-0001-0066-1000-597aa65619fc"
    }
  ]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/appendix/webhook_resend"

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

post_data = [
    {
        "id": "08161139-0001-0066-1000-06491d097ed5"
    },
    {
        "id": "08161340-0001-0066-1000-8b091c84af4f"
    },
    {
        "id": "08161703-0001-0066-1000-597aa65619fc"
    }
]

response = requests.post(url, headers=headers, json=post_data)
result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        "请求失败。状态码:%s,消息:%s"
        % (result.get("status_code"), result.get("status_message"))
    )

TypeScript

typescript
import axios from "axios";

const postData = [
  {
    id: "08161139-0001-0066-1000-06491d097ed5",
  },
  {
    id: "08161340-0001-0066-1000-8b091c84af4f",
  },
  {
    id: "08161703-0001-0066-1000-597aa65619fc",
  },
];

axios
  .post(
    "https://api.seermartech.cn/v3/appendix/webhook_resend",
    postData,
    {
      headers: {
        Authorization: "Bearer smt_live_YOUR_KEY",
        "Content-Type": "application/json",
      },
    }
  )
  .then((response) => {
    // 处理响应数据
    console.log(response.data);
  })
  .catch((error) => {
    // 处理请求错误
    console.error(error);
  });

响应

接口返回 JSON 数据 tasks 数组。每个任务对象会说明 Webhook 重发的处理结果。

顶层响应字段

字段类型说明
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 路径。
dataarray/object请求参数数据,原任务 GET 请求 URL 中使用的参数。
resultarray/null结果数组。对于本接口,该字段始终为 null;重发结果将通过原任务设置的 Pingback 或 Postback 地址接收。

成功响应示例

json
{
  "version": "0.1.20210818",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.1337 sec.",
  "cost": 0,
  "tasks_count": 3,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "08161139-0001-0066-1000-06491d097ed5",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.0087 sec.",
      "cost": 0,
      "result_count": 0,
      "path": [],
      "data": {
        "api": "serp",
        "function": "task_post",
        "id": "08161139-0001-0066-1000-06491d097ed5",
        "se": "google",
        "se_type": "organic",
        "language_name": "English",
        "location_name": "London,England,United Kingdom",
        "keyword": "marcus rashford",
        "priority": 2,
        "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    },
    {
      "id": "08161340-0001-0066-1000-8b091c84af4f",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.0087 sec.",
      "cost": 0,
      "result_count": 0,
      "path": [],
      "data": {
        "api": "serp",
        "function": "task_post",
        "id": "08161340-0001-0066-1000-8b091c84af4f",
        "se": "google",
        "se_type": "organic",
        "language_name": "English",
        "location_name": "London,England,United Kingdom",
        "keyword": "marcus rashford",
        "priority": 2,
        "postback_url": "https://your-server.com/postbackscript.php?id=$id&tag=$tag",
        "postback_data": "advanced",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    },
    {
      "id": "08161703-0001-0066-1000-597aa65619fc",
      "status_code": 40503,
      "status_message": "'pingback' or 'postback' not supported in this function.",
      "time": "0.0045 sec.",
      "cost": 0,
      "result_count": 0,
      "path": [],
      "data": {
        "api": "serp",
        "function": "task_post",
        "language_name": "English",
        "location_name": "London,England,United Kingdom",
        "keyword": "marcus rashford",
        "priority": 2,
        "se": "google",
        "se_type": "organic",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    }
  ]
}

状态码与错误处理

  • 顶层 status_code20000 表示请求成功。
  • 任务级别的 status_code 需要单独判断,因为同一批请求中可能同时成功和失败的任务。
  • tasks_error 表示返回错误的任务数量。
  • 当任务不支持 Pingback 或 Postback 时,任务可能返回 40503,例如:
text
'pingback' or 'postback' not supported in this function.

建议客户端同时处理 HTTP 错误、顶层状态码和任务级状态码,并记录 status_message 以便排查异常。

实用场景

  • 重发失败的 SEO 排名回调:针对未成功接收结果的排名任务重新发送 Webhook,业务系统遗漏排名数据。
  • 补发中断的批量任务通知:在回调服务短暂障或网络异常后,批量恢复任务完成通知,减少人工补录成本。
  • 验证回调链路可用性:对指定任务重新触发 Pingback 或 Postback,检查接收服务、签名校验和库流程是否正常。
  • 修复数据同步缺口:根据业务系统记录的任务 ID 重发回调,补齐 SEO 监控平台中的历史任务状态。
  • 处理部分失败任务:从批量响应中筛选错误任务 ID 后再次提交重试失败项,重复处理已成功任务。

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