主题
Business Data 任务 ID 列表
POST /v3/business_data/id_list
本接口通过 POST 方法调用:/v3/business_data/id_list。用于按指定时间范围获取本平台已创建的 Business Data 任务 ID 及数据,结果已完成和未完成的任务。
接口信息
- 请求方法:
POST - 请求路径:
/v3/business_data/id_list - 完整 URL:
https://api.seermartech.cn/v3/business_data/id_list - 请求格式:JSON
- 认证方式:Bearer Token
- 频率限制:每分钟最多调用 10 次
- 单次返回上限:1000 个任务 ID
- 查询范围:
include_metadata=true:最多查询当前时间前 1 个月创建的任务include_metadata=false:最多查询当前时间前 6 个月创建的任务
- 计费:本接口不收取费用。扣费以响应头
X-SeerMarTech-Charge-CNY为准。
> 所有 POST 请求体使用 UTF-8 编码的 JSON 数组格式,即使只提交一个查询对象,也需要放在数组中。
请求参数
请求体示例:
json
[
{
"datetime_from": "2023-01-15 12:57:46 +00:00",
"datetime_to": "2023-01-31 13:57:46 +00:00",
"limit": 100,
"offset": 0,
"sort": "desc",
"include_metadata": true
}
]| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
datetime_from | string | 是 | 结果筛选的起始时间。<br><br>当 include_metadata=true 时,最早只能查询当前时间前 1 个月的数据;当 include_metadata=false 时,最早只能查询当前时间前 6 个月的数据。<br><br>使用 UTC 时间格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2023-01-15 12:57:46 +00:00 |
datetime_to | string | 是 | 结果筛选的结束时间,不能晚于当前时间。<br><br>使用 UTC 时间格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2023-01-31 13:57:46 +00:00 |
limit | integer | 否 | 返回的最大任务 ID 数量。默认值为 1000,最大值为 1000。 |
offset | integer | 否 | 结果数组的偏移量,默认值为 0。例如设置为 10,则跳过结果中的前 10 个任务。 |
sort | string | 否 | 按任务执行时间排序。可选值:asc、desc。默认值为 asc。 |
include_metadata | boolean | 否 | 是否在响应中任务数据。默认值为 false。 |
响应结构
接口返回 JSON 数据 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求的通用状态码。成功时通常为 20000。完整状态码请参考错误码说明。 |
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 | 请求路径信息。 |
data | object | 创建任务时提交的参数。 |
result | array | 任务结果数组。 |
result 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID。 |
url | string | 创建该任务时使用的 API URL。 |
datetime_posted | string | 任务创建时间,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
datetime_done | string | 任务完成时间,使用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。任务未完成时可能为空。 |
status | string | 任务状态提示信息。完整状态说明请参考错误码说明。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
metadata | object | 创建任务时提交的参数在 include_metadata=true 且任务位于的时间范围时返回。 |
curl 示例
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/business_data/id_list" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"datetime_from": "2023-01-31 00:00:00 +00:00",
"datetime_to": "2023-02-01 00:00:00 +00:00",
"limit": 100,
"offset": 0,
"sort": "desc",
"include_metadata": true
}
]'PHP 示例
php
<?php
$apiUrl = 'https://api.seermartech.cn/v3/business_data/id_list';
$postData = [
[
'datetime_from' => '2023-01-31 00:00:00 +00:00',
'datetime_to' => '2023-02-01 00:00:00 +00:00',
'limit' => 100,
'offset' => 0,
'sort' => 'desc',
'include_metadata' => true
]
];
$ch = curl_init($apiUrl);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode($postData, JSON_UNESCAPED_UNICODE)
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
$result = json_decode($response, true);
print_r($result);TypeScript 示例
typescript
import axios from "axios";
const postData = [
{
datetime_from: "2023-01-31 00:00:00 +00:00",
datetime_to: "2023-02-01 00:00:00 +00:00",
limit: 100,
offset: 0,
sort: "desc",
include_metadata: true,
},
];
axios
.post(
"https://api.seermartech.cn/v3/business_data/id_list",
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/business_data/id_list"
post_data = [
{
"datetime_from": "2023-01-31 00:00:00 +00:00",
"datetime_to": "2023-02-01 00:00:00 +00:00",
"limit": 100,
"offset": 0,
"sort": "desc",
"include_metadata": True,
}
]
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.post(
url,
json=post_data,
headers=headers,
timeout=60,
)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
"请求失败,状态码:%s,提示:%s"
% (result.get("status_code"), result.get("status_message"))
)响应示例
json
{
"version": "0.1.20221214",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.4222 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "2f3b7e8e-2ad1-4c1c-9c9f-123456789abc",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1200 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"business_data",
"id_list"
],
"data": {
"api": "business_data",
"function": "id_list",
"datetime_from": "2023-01-11 00:00:00 +00:00",
"datetime_to": "2023-02-10 17:47:00 +00:00",
"limit": 100,
"sort": "desc",
"include_metadata": true
},
"result": [
{
"id": "8c2d6a3f-7d1e-4d3a-9a1b-abcdef123456",
"url": "https://api.seermartech.cn/v3/business_data/id_list",
"datetime_posted": "2023-01-15 12:57:46 +00:00",
"datetime_done": "2023-01-15 12:58:02 +00:00",
"status": "Ok.",
"cost": 0,
"metadata": {
"datetime_from": "2023-01-15 12:00:00 +00:00",
"datetime_to": "2023-01-15 13:00:00 +00:00"
}
}
]
}
]
}实用场景
- 分页拉取历史任务 ID,批量获取指定时间范围的任务,便于构建任务监控和结果回溯流程。
- 筛选未完成任务,结合任务状态字段识别仍在处理或异常的任务,及时触发补偿查询。
- 同步任务数据,通过
include_metadata=true获取任务创建参数,便于审计请求和复现历史任务。 - 按执行时间排序任务,使用
sort=asc或sort=desc构建增量同步流程,减少重复处理数据。 - 统计任务处理,利用
tasks_count、tasks_error和任务状态码监测批量 SEO 数据任务的成功率与异常率。