主题
Webhook 重发
接口说明
通过本接口,你可以对最多 100 个已存在任务重新发送 webhook 回调:
pingbackpostback
适用于回调丢失、接收服务短暂不可用、需要补发通知等场景。
注意:
- 重发 webhook 不会重复计费。
- 本接口本身不收费,参考价约 ¥0.0000 / 次。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求信息
请求方式: POST请求地址: https://api.seermartech.cn/v3/appendix/webhook_resend
请求体格式
所有 POST 数据使用 UTF-8 编码的 JSON 格式提交。 请求体为 JSON 数组,数组中每个对象对应一个需要重发 webhook 的任务。
请求参数
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
| 最多可提交 100 个任务 ID | ||
| 每个任务 ID 需要作为数组中的单独对象传 |
请求示例
json
[
{
"id": "08161139-0001-0066-1000-06491d097ed5"
},
{
"id": "08161340-0001-0066-1000-8b091c84af4f"
},
{
"id": "08161703-0001-0066-1000-597aa65619fc"
}
]响应结构
接口返回 JSON 数据, tasks 数组,每个对应一个重发请求任务的处理结果。
顶层响应字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 接口整体状态码 |
status_message | string | 接口整体状态信息 |
time | string | 总执行时间,单位秒 |
cost | float | 本次请求总费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | 返回错误的任务数量 |
tasks | array | 任务结果数组 |
完整错误码与状态信息请参考
/v3/appendix/errors。 建议在接时为异常和错误场景设计完善的处理机制。
tasks 数组字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态信息 |
time | string | 当前任务执行时间,单位秒 |
cost | float | 当前任务费用,单位 USD |
result_count | integer | result 数组中的数量 |
path | array | 请求路径 |
data | array | 该任务原始请求中的参数信息 |
result | array/null | 结果数组,该接口中该值始终为 null |
result
本接口不会直接返回 webhook 数据,result 始终为 null。 回调结果会按你在原始任务中设置的方式重新投递:
pingbackpostback
也就是说,数据仍通过你在建任务时的回调地址获取。
调用示例
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"
}
payload = [
{
"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=payload)
data = response.json
if data.get("status_code") == 20000:
print(data)
else:
print(f"error. Code: {data.get('status_code')} Message: {data.get('status_message')}")TypeScript
typescript
import axios from "axios";
const postArray = [
{
id: "08161139-0001-0066-1000-06491d097ed5"
},
{
id: "08161340-0001-0066-1000-8b091c84af4f"
},
{
id: "08161703-0001-0066-1000-597aa65619fc"
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/appendix/webhook_resend",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
data: postArray
})
.then((response) => {
// 返回结果
console.log(response.data);
})
.catch((error) => {
console.error(error);
});响应示例
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.0078 sec.",
"cost": 0,
"result_count": 0,
"path": [],
"data": {
"api": "serp",
"function": "task_post",
"id": "08161340-0001-0066-1000-8b091c8489db",
"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",
"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
}
]
}状态与错误说明
顶层状态码
20000:请求成功
常见任务级状态
20100:任务已创建,表示 webhook 重发请求已成功受理40503:当前功能不支持pingback或postback
更多错误码请参考 /v3/appendix/errors。
使用注意事项
- 支持对已存在的任务重发 webhook。
- 只有原任务过
pingback或postback时,重发才有意义。 - 单次最多提交 100 个任务 ID。
- 如果某类任务本身不支持回调机制,接口会返回相应错误,例如
40503。 - 本接口只负责触发重新投递,不直接返回原始结果数据。
实用场景
- 补发回调:当你的回调接收服务短暂宕机或时时,按任务 ID 批量补发 webhook,减少结果丢失。
- 校验回调链路:对历史任务重新触发
pingback或postback,验证回调地址、鉴权逻辑和消息处理程序是否正常。 - 修复异步漏单:当任务已完成但业务系统未库时,通过重发 webhook 补齐缺失结果,提升数据完整性。
- 批量恢复任务通知:针对一批重要 SEO 任务统一重发回调,逐条手工排查,提高运维效率。
- 排查接口容性:结合任务级错误码识别哪些任务类型支持或不支持 webhook,优化异步采集架构设计。