主题
app_data/errors:应用数据错误任务查询
POST /v3/app_data/errors
本接口使用 POST 方法,请求路径为:
/v3/app_data/errors
用于查询过去 7 天返回错误的应用数据任务。若通过 webhook(pingback 或 postback)提交任务后,因服务器错误未收到回调,可使用本接口获取任务 ID,再调用 webhook 重发接口重新发送通知。
如果某个任务未出现在结果列表中,表示该任务未返回错误,或尚未完成处理。
计费说明
本接口调用不收取费用。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求说明
请求头:
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json请求体使用 UTF-8 编码的 JSON 数组:
json
[
{
"limit": 10,
"offset": 0,
"filtered_function": "pingback_url"
}
]请求参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
limit | integer | 否 | 返回的错误任务最大数量。默认值为 1000,最大值为 1000。 |
offset | integer | 否 | 结果偏移量,默认值为 0。例如设置为 10 时,将跳过结果数组中的前 10 个任务,返回后续任务。 |
filtered_function | string | 否 | 按指定 API 函数筛选错误任务。可使用响应中 function 字段返回的值进行筛选,例如 app_data/task_get/advanced、postback_url、pingback_url。 |
datetime_from | string | 否 | 错误时间筛选起始时间。支持过去 7 天范围,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2021-11-15 12:57:46 +00:00。 |
datetime_to | string | 否 | 错误时间筛选结束时间。支持过去 7 天范围,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2021-11-15 13:57:46 +00:00。 |
响应说明
接口返回 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 | array | 创建任务时提交的参数,与 POST 请求中的参数一致。 |
result | array | 错误任务数组。 |
tasks.result 对象字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 错误任务 ID。 |
datetime | string | 错误发生的时间,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如:2019-11-15 12:57:46 +00:00。 |
function | string | 产生错误的 API 函数。 |
error_code | integer | 错误码。 |
error_message | string | 错误信息,或导致错误的 URL。 |
http_url | string | 导致错误的 URL,可以是 API 请求地址,也可以是 pingback/postback 回调地址。 |
http_method | string | HTTP 请求方法。 |
http_code | integer | HTTP 状态码。 |
http_time | float | HTTP 请求耗时,单位为秒。对于了 pingback/postback 的任务,该字段表示本平台您的服务器响应所耗费的时间。 |
http_response | string | HTTP 响应,即服务器返回的响应。 |
状态码及错误信息请参考错误码文档。
curl 示例
bash
curl --location --request POST "https://api.seermartech.cn/v3/app_data/errors" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"limit": 10,
"offset": 0,
"filtered_function": "pingback_url"
}
]'TypeScript 示例
typescript
import axios from "axios";
const postData = [
{
limit: 10,
offset: 0,
filtered_function: "pingback_url",
},
];
axios
.post(
"https://api.seermartech.cn/v3/app_data/errors",
postData,
{
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/app_data/errors"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
post_data = [
{
"limit": 10,
"offset": 0,
"filtered_function": "pingback_url",
}
]
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"))
)PHP 示例
php
<?php
$url = 'https://api.seermartech.cn/v3/app_data/errors';
$postData = [
[
'limit' => 10,
'offset' => 0,
'filtered_function' => 'pingback_url',
],
];
$options = [
'http' => [
'method' => 'POST',
'header' => implode("\r\n", [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json',
]),
'content' => json_encode($postData, JSON_UNESCAPED_UNICODE),
'ignore_errors' => true,
],
];
$response = file_get_contents(
$url,
false,
stream_context_create($options)
);
$result = json_decode($response, true);
if (($result['status_code'] ?? null) === 20000) {
print_r($result);
} else {
echo '请求失败:' . ($result['status_message'] ?? '未知错误');
}响应示例
json
{
"version": "0.1.20220321",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1538 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "463e9406-0691-4dತ್ತ1-bf5-0b4f3f6f1f9d",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1538 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"app_data",
"errors"
],
"data": [
{
"api": "app_data",
"function": "errors",
"limit": 10,
"offset": 0,
"filtered_function": "pingback_url"
}
],
"result": [
{
"id": "7f2f8b2e-7a48-4f58-9f7e-6b48d79d4c3a",
"datetime": "2021-11-15 13:20:46 +00:00",
"function": "pingback_url",
"error_code": 50000,
"error_message": "Internal Server Error",
"http_url": "https://example.com/pingback",
"http_method": "POST",
"http_code": 500,
"http_time": 2.341,
"http_response": "Internal Server Error"
}
]
}
]
}实用场景
- 排查未收到的 webhook 回调:按
pingback_url或postback_url筛选错误任务,定位回调失败的任务 ID,及时重发通知。 - 监控应用数据任务异常:定期查询过去 7 天的错误记录,统计不同 API 函数的失败,发现系统性问题。
- 分析客户回调服务器稳定性:结合
http_code、http_time和http_response判断客户服务器的时、拒绝请求或 5xx 错误。 - 按时间窗口追踪障:使用
datetime_from与datetime_to查询特定时间段的错误,发布变更或服务器障复盘。 - 批量恢复失败任务:读取错误结果中的
id和function字段,筛选需要补偿处理的任务,减少数据回调丢失。