主题
根据任务 ID 获取 Amazon Sellers HTML 结果
本接口使用 GET 方法,通过任务 ID 获取 Amazon Sellers 任务的 HTML 结果。
请求方法与路径:
http
GET https://api.seermartech.cn/v3/merchant/amazon/sellers/task_get/html/$id任务结果可在任务创建后的 7 天查询。任务本身的费用在提交任务时扣除,结果查询不会重复计费。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
路径参数
| 参数名 | 类型 | 填 | 说明 |
|---|---|---|---|
id | string | 是 | 任务唯一标识,UUID 格式。任务创建后 7 天可使用该 ID 查询结果。 |
认证
请求头中需要携带访问密钥:
http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json请求示例
cURL
bash
id="04171157-0696-0183-0000-4f63affdd40a"
curl --location --request GET \
"https://api.seermartech.cn/v3/merchant/amazon/sellers/task_get/html/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
task_id = "02231453-2604-0066-2000-64d39c6677d4"
url = f"https://api.seermartech.cn/v3/merchant/amazon/sellers/task_get/html/{task_id}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers, timeout=60)
response.raise_for_status()
data = response.json()
if data.get("status_code") != 20000:
raise RuntimeError(
f"请求失败:{data.get('status_code')} {data.get('status_message')}"
)
print(data)TypeScript
typescript
import axios from "axios";
const taskId = "02231453-2604-0066-2000-64d39c6677d4";
axios
.get(
`https://api.seermartech.cn/v3/merchant/amazon/sellers/task_get/html/${taskId}`,
{
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);
});响应说明
接口返回 JSON 数据,顶层 tasks 数组。每个任务对象任务状态、执行信息以及 HTML 结果。
顶层响应字段
| 字段名 | 类型 | 说明 |
|---|---|---|
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 | object | 创建任务时提交的参数。 |
result | array | 任务结果数组。 |
tasks[].data 字段
data 对象创建任务时提交的请求参数,例如搜索引擎、语言、地区、ASIN、设备和操作系统等。
| 字段名 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型,本接口通常为 sellers。 |
api | string | API 类型,本接口为 merchant。 |
function | string | 功能名称,本接口为 sellers。 |
se | string | 搜索引擎名称,本接口为 amazon。 |
language_code | string | 语言代码。 |
location_code | integer | 地区代码。 |
asin | string | Amazon ASIN。 |
priority | integer | 任务优级。 |
device | string | 设备类型,例如 desktop。 |
os | string | 操作系统,例如 windows。 |
tasks[].result 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
asin | string | 创建任务时提交的 ASIN。 |
type | string | 创建任务时提交的搜索引擎类型。 |
se_domain | string | 创建任务时提交的搜索引擎域名。 |
location_code | integer | 创建任务时提交的地区代码。 |
language_code | string | 创建任务时提交的语言代码。 |
datetime | string | 获取结果的日期和时间,使用 UTC 格式:yyyy-MM-dd HH:mm:ss +00:00。示例:2019-11-15 12:57:46 +00:00。 |
items_count | integer | items 数组中的结果数量。 |
items | array | Amazon 搜索结果页面中的结果集合。 |
tasks[].result[].items 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
page | integer | 返回的 HTML 页面序号。 |
date | string | HTML 页面抓取时间,使用 UTC 格式:yyyy-MM-dd HH:mm:ss +00:00。示例:2019-11-15 12:57:46 +00:00。 |
html | string | 抓取到的 HTML 页面。 |
响应示例
json
{
"version": "0.1.20200416",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1269 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "04171157-0696-0183-0000-4f63affdd40a",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1023 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"merchant",
"amazon",
"sellers",
"task_get",
"html"
],
"data": {
"se_type": "sellers",
"api": "merchant",
"function": "sellers",
"se": "amazon",
"language_code": "en",
"location_code": 2840,
"asin": "B088NFXLRV",
"priority": 2,
"device": "desktop",
"os": "windows"
},
"result": [
{
"asin": "B088NFXLRV",
"type": "sellers",
"se_domain": "amazon.com",
"location_code": 2840,
"language_code": "en",
"datetime": "2019-11-15 12:57:46 +00:00",
"items_count": 1,
"items": [
{
"page": 1,
"date": "2019-11-15 12:57:46 +00:00",
"html": "<html>...</html>"
}
]
}
]
}
]
}状态码与错误处理
- 顶层
status_code为20000,表示请求成功。 - 任务级别的
status_code用于表示任务是否成功。 - 当任务级别状态码为错误状态,或
result为空时,应优读取status_message获取错误原因。 - 完整状态码和说明请参考错误码文档。
实用场景
- 抓取 Amazon 卖家页面 HTML:获取指定 ASIN 的卖家信息页面,用于构建竞品卖家监测和价格跟踪系统。
- 保存历史页面快:定期查询任务结果并归档 HTML,用于分析卖家数量、方式和商品销售状态变化。
- 解析竞品卖家数据:对返回的 HTML 页面进行结构化解析,提取卖家报价、库存和信息,支持竞品研究。
- 监控不同地区的卖家结果:结合地区代码和语言代码查询不同市场页面,比较同一 ASIN 在各 Amazon 站点的卖家表现。
- 构建任务结果回收流程:根据任务 ID 批量获取已完成任务,减少重复提交任务产生的费用,并提高数据采集效率。