主题
获取 Tripadvisor 评论已完成任务
GET /v3/business_data/tripadvisor/reviews/tasks_ready
本接口使用 GET 方法,路径为:
/v3/business_data/tripadvisor/reviews/tasks_ready
用于获取已完成但尚未领取的 Tripadvisor 评论采集任务列表。获取任务 ID 后,可通过对应的任务结果接口继续领取任务数据。
如果提交任务时了 postback_url,正常完成的任务不会出现在本接口返回列表中。当向回调地址发送请求失败,且服务端返回的 HTTP 状态码小于 200 或大于 300 时,任务才可能出现在领取列表中。
> 由于系统架构原因,已完成任务队列可能存在少量延迟。若每分钟需要领取 1000 个任务,建议优使用回调机制,并将本接口用于检查回调失败的任务。
请求地址
http
GET https://api.seermartech.cn/v3/business_data/tripadvisor/reviews/tasks_ready也可以使用以下通用路径:
http
GET https://api.seermartech.cn/v3/business_data/$se/tasks_ready$se 为搜索引擎名称。本业务支持:
text
tripadvisor获取所有 Business Data API 已完成任务时,可使用:
http
GET https://api.seermartech.cn/v3/business_data/tasks_ready计费与限制
- 获取已完成任务列表不产生额外费用。
- 每个任务会一直保留在列表中,直到被成功领取。
- 每分钟最多调用 20 次。
- 每次调用最多返回过去 3 天完成的 1000 个任务。
- 任务完成 3 天仍未领取后,将不会继续出现在列表中。
- 使用回调机制时,正常投递成功的任务不会出现在本接口中。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求头
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json本接口为 GET 请求,不需要请求体。
响应说明
接口返回 JSON 数据 tasks 数组已完成任务的信息。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码。完整列表参见 /v3/appendix/errors |
status_message | string | 通用状态说明。完整列表参见 /v3/appendix/errors |
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。完整列表参见 /v3/appendix/errors |
status_message | string | 任务状态说明 |
time | string | 任务执行耗时,单位为秒 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量 |
path | array | 请求路径信息 |
data | object | 请求 URL 中传的参数 |
result | array | 任务结果摘要 |
result 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 已完成任务的唯一标识,UUID 格式 |
se | string | 创建任务时指定的搜索引擎,固定为 tripadvisor |
se_type | string | 搜索引擎类型 |
date_posted | string | 任务提交时间,使用 UTC 时间格式 |
tag | string | 用户自定义任务标识 |
endpoint | string | 用于领取任务结果的 URL 路径 |
curl 示例
bash
curl --location --request GET \
"https://api.seermartech.cn/v3/business_data/tripadvisor/reviews/tasks_ready" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"PHP 示例
php
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.seermartech.cn/v3/business_data/tripadvisor/reviews/tasks_ready',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json',
],
]);
$response = curl_exec($ch);
if ($response === false) {
echo '请求失败:' . curl_error($ch);
} else {
$result = json_decode($response, true);
print_r($result);
}
curl_close($ch);TypeScript 示例
typescript
import axios from "axios";
axios
.get(
"https://api.seermartech.cn/v3/business_data/tripadvisor/reviews/tasks_ready",
{
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/tripadvisor/reviews/tasks_ready"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
if response.ok:
result = response.json()
# 处理已完成任务列表
print(result)
else:
print(f"请求失败,HTTP 状态码:{response.status_code}")
print(response.text)C# 示例
csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
public class Demo
{
public static async Task GetTripadvisorReviewsTasksReady()
{
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/tripadvisor/reviews/tasks_ready"
);
var result = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
// 处理已完成任务列表
Console.WriteLine(result);
}
else
{
Console.WriteLine(
$"请求失败,HTTP 状态码:{(int)response.StatusCode},响应:{result}"
);
}
}
}响应示例
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": " შეიძლება-example-task-id",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1200 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"business_data",
"tripadvisor",
"reviews",
"tasks_ready"
],
"data": {
"api": "business_data",
"function": "reviews",
"se": "tripadvisor",
"se_type": "reviews"
},
"result": [
{
"id": "completed-task-id",
"se": "tripadvisor",
"se_type": "reviews",
"date_posted": "2024-01-15 10:30:00 +00:00",
"tag": "tripadvisor-review-task",
"endpoint": "/v3/business_data/tripadvisor/reviews/task_get"
}
]
}
]
}实用场景
- 轮询已完成任务:定期获取 Tripadvisor 评论采集任务 ID,及时触发结果领取流程,减少任务积压。
- 补偿回调失败任务:检查未成功投递到回调地址的任务,评论数据因回调异常而丢失。
- 控制高并发领取节奏:根据每次最多 1000 个任务和每分钟 20 次调用的限制设计任务调度,保障系统稳定运行。
- 追踪批量采集进度:结合
tag、date_posted和status_code统计不同批次评论任务的完成。 - 筛选特定搜索引擎任务:通过
se和se_type识别 Tripadvisor 评论任务,便于与 Business Data 任务分流处理。