主题
获取 Trustpilot Reviews 已完成任务
GET /v3/business_data/trustpilot/reviews/tasks_ready
本接口使用 GET 方法和以下路径:
GET /v3/business_data/trustpilot/reviews/tasks_ready
用于获取已完成但尚未被收集的 Trustpilot Reviews 任务列表。调用本接口后,可获取任务 id,再通过任务结果接口收集对应结果。
如果提交任务时设置了 postback_url,正常任务不会出现在本接口返回列表中。当向回调地址发送请求失败,且目标服务器返回的 HTTP 状态码小于 200 或大于 300 时,任务才可能重新出现在列表中。
> 注意:由于任务队列存在少量更新延迟,本接口不适合高频、大规模轮询。如果系统每分钟需要收集 1000 个任务,建议优使用回调通知机制,并将本接口用于查询回调失败的任务。
接口路径
除 Trustpilot Reviews 专用路径外,本平台还支持以下通用路径:
text
GET /v3/business_data/wp/reviews/tasks_ready
GET /v3/business_data/$se/tasks_ready
GET /v3/business_data/tasks_ready:
$se为搜索引擎或数据源名称。- Trustpilot Reviews 使用
trustpilot。 - 本页面对应的完整路径为
/v3/business_data/trustpilot/reviews/tasks_ready。
计费与调用限制
- 获取已完成任务列表不产生费用,参考价为 ¥0 / 次。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。 - 每个任务在被成功收集前会持续保留在列表中。
- 每分钟最多调用 20 次。
- 每次调用最多返回 1000 个任务。
- 返回范围为调用时间前 3 天完成的任务。
- 已被收集的任务不会再次返回。
- 完成 3 天仍未收集的任务不会继续保留在列表中。
- 使用
postback_url且回调成功的任务不会出现在列表中。
请求
请求方法
text
GET请求 URL
text
https://api.seermartech.cn/v3/business_data/trustpilot/reviews/tasks_ready请求头
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json本接口不需要请求体。
响应说明
接口返回 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 | 结果收集路径 |
data | object | 创建任务时传的请求参数 |
result | array | 任务结果列表 |
result素字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 已完成任务的唯一标识,UUID 格式 |
se | string | 创建任务时指定的数据源,固定为 trustpilot |
se_type | string | 数据类型,固定为 reviews |
date_posted | string | 任务提交时间,UTC 格式 |
tag | string | 用户自定义任务标识 |
endpoint | string | 用于收集任务结果的 URL |
请求示例
cURL
bash
curl --location --request GET \
"https://api.seermartech.cn/v3/business_data/trustpilot/reviews/tasks_ready" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
url = "https://api.seermartech.cn/v3/business_data/trustpilot/reviews/tasks_ready"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
data = response.json()
if data.get("status_code") == 20000:
print(data)
# 根据 tasks 中的 endpoint 或 id 收集任务结果
else:
print(
"请求失败。状态码: %s,消息: %s"
% (data.get("status_code"), data.get("status_message"))
)TypeScript
typescript
import axios from "axios";
axios
.get(
"https://api.seermartech.cn/v3/business_data/trustpilot/reviews/tasks_ready",
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
)
.then((response) => {
const result = response.data;
if (result.status_code === 20000) {
console.log(result);
// 根据 tasks 中的 endpoint 或 id 收集任务结果
} else {
console.error(
`请求失败。状态码: ${result.status_code},消息: ${result.status_message}`
);
}
})
.catch((error) => {
console.error("网络或请求异常:", error.message);
});PHP
php
<?php
$url = 'https://api.seermartech.cn/v3/business_data/trustpilot/reviews/tasks_ready';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
$result = json_decode($response, true);
if (($result['status_code'] ?? null) === 20000) {
print_r($result);
// 根据 tasks 中的 endpoint 或 id 收集任务结果
} else {
echo "请求失败。状态码: "
. ($result['status_code'] ?? 'unknown')
. ",消息: "
. ($result['status_message'] ?? 'unknown');
}C#
csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
public class TrustpilotTasksReady
{
public static async Task Main()
{
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/trustpilot/reviews/tasks_ready"
);
var result = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
Console.WriteLine(result);
// 解析 tasks,并根据 endpoint 或 id 收集任务结果
}
else
{
Console.WriteLine(
$"请求失败。HTTP 状态码: {(int)response.StatusCode}"
);
}
}
}响应示例
json
{
"version": "0.1.20210917",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1630 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1200 sec.",
"cost": 0,
"result_count": 0,
"path": [
"v3",
"business_data",
"trustpilot",
"reviews",
"tasks_ready"
],
"data": {
"api": "business_data",
"function": "reviews",
"se": "trustpilot",
"se_type": "reviews"
},
"result": []
}
]
}如果没有可收集的已完成任务,tasks 可能为空数组,或响应中的任务结果为空。
错误处理
请根据以下字段处理请求级和任务级异常:
status_code:判断请求或任务是否成功。status_message:获取对应的说明信息。tasks_error:确认本次返回的任务中是否存在错误。tasks[].status_code:定位任务的处理状态。tasks[].status_message:获取任务的错误或状态说明。
建议客户端对网络异常、频率限制、任务过期以及任务结果收集失败进行重试或告警处理。
实用场景
- 轮询已完成任务:定期获取尚未收集的 Trustpilot Reviews 任务 ID,及时拉取评论结果并更新业务数据库。
- 补偿回调失败任务:筛选未成功触达回调地址的任务,评论数据因通知失败而丢失。
- 控制大批量任务处理进度:每次最多 1000 个任务的限制分批收集结果,降低系统瞬时负载。
- 监控评论采集延迟:结合
date_posted、time和任务状态码,识别任务队列延迟或处理异常。 - 业务记录:利用任务中的
tag字段,将评论采集结果到站点、客户或 SEO 项目。