Skip to content

设置亚马逊商品查询任务

POST /v3/merchant/amazon/products/task_post

本接口使用 POST 方法,通过路径 /v3/merchant/amazon/products/task_post 创建亚马逊商品查询任务。接口根据指定的、地区和语言,获取亚马逊商品搜索结果。

请求地址:

text
POST https://api.seermartech.cn/v3/merchant/amazon/products/task_post

接口说明

  • 请求体使用 UTF-8 编码的 JSON 格式。
  • 请求体是任务对象数组:[{ ... }]
  • 单次请求最多 100 个任务。 平台限流以认证说明中的 30/60/120 次/分钟规则为准。
  • 如果单次请求 100 个任务,出部分将返回错误码 40006
  • 创建任务后,可通过返回的任务 id 查询结果。
  • 也可以通过 postback_urlpingback_url 接收任务完成通知。
  • 如果接收服务器在 10 秒未返回响应,连接将因时中断,任务会转 /v3/merchant/amazon/products/tasks_ready/ 列表。

计费说明

本接口在成功创建任务时计费。高优级任务(priority=2)会产生额外费用;当查询深度 100 且返回 100 条结果时,也可能产生额外费用。

扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

以下字段需要放请求体数组中的任务对象。

参数类型说明
keywordstring查询,填。最多 700 个字符。所有 %## 编码会被解码,字符 + 会被解码为空格。如果中需要使用 %,应写为 %25
urlstring搜索查询的完整 URL,可选。接口会从 URL 中解析参数。该方式处理复杂,并且要求 URL 中准确的语言和地区信息,通常不建议使用。示例:https://www.amazon.com/s/?field-keywords=shoes&language=en_US
priorityinteger任务优级,可选。1:普通优级,默认值;2:高优级,处理速度更快但会产生额外费用。
location_namestring搜索地区的完整名称。当未指定 location_codelocation_coordinate 时填。示例:HA1,England,United Kingdom
location_codeinteger搜索地区编码。当未指定 location_namelocation_coordinate 时填。示例:9045969
location_coordinatestring地区 GPS 坐标。当未指定 location_namelocation_code 时填。格式为 纬度,经度,半径,纬度和经度最多 7 位小数,半径最小值为 199.9。示例:53.476225,-2.243572,200
language_namestring搜索语言的完整名称。当未指定 language_code 时填。示例:English (United Kingdom)
language_codestring搜索语言编码。当未指定 language_name 时填。示例:en_GB
se_domainstring亚马逊站点域名,可选。默认根据地区和语言自动选择,也可以手动指定,例如 amazon.comamazon.co.ukamazon.fr
depthinteger解析深度,即需要获取的商品结果数量。默认值为 100,最大值为 700。每 100 条结果作为一个计费单位;当设置值 100 且返回 100 条结果时,可能产生额外费用。
max_crawl_pagesinteger最多抓取的搜索结果页数,可选,最大值为 7。该参数与 depth合使用。
departmentstring亚马逊商品分类,可选。支持以下值:Arts & CraftsAutomotiveBabyBeauty & Personal CareBooksComputersDigital MusicElectronicsKindle StorePrime VideoWomen's FashionMen's FashionGirls' FashionBoys' FashionDealsHealth & HouseholdHome & KitchenIndustrial & ScientificLuggageMovies & TVMusic, CDs & VinylPet SuppliesSoftwareSports & OutdoorsTools & Home ImprovementToys & GamesVideo Games
search_paramstring搜索附加参数,可选。可使用亚马逊搜索 URL 参数,例如 &low-price=52&high-price=45&sort=relevancerank&sort=featured-rank&sort=price-asc-rank&sort=price-desc-rank&sort=review-rank&sort=date-desc-rank。如果设置了 price_minprice_maxsort_by,该字段将被忽略。
price_mininteger返回商品的最低价格,可选。设置后将忽略 search_param。示例:5
price_maxinteger返回商品的最高价格,可选。设置后将忽略 search_param。示例:100
sort_bystring商品排序规则,可选。支持:relevanceprice_low_to_highprice_high_to_lowfeaturedavg_customer_reviewnewest_arrival。设置后将忽略 search_param。示例:relevance
tagstring用户自定义任务标识,可选,最多 255 个字符。可用于任务与结果,提交的值会出现在响应的 data 对象中。
postback_urlstring任务结果接收地址,可选。任务完成后,本平台会向该地址发送 POST 请求,结果使用 gzip 格式压缩。URL 中可使用 $id$tag 占位符,发送前会替换为任务 ID 和经过 URL 编码的标签值。示例:https://your-server.com/postbackscript?id=$id&tag=$tag
postback_datastringpostback_url 返回数据类型。当指定 postback_url 时填。支持:advancedhtml
pingback_urlstring任务完成通知地址,可选。任务完成后,本平台会向该地址发送 GET 请求。URL 中可使用 $id$tag 占位符。示例:https://your-server.com/pingscript?id=$id&tag=$tag

地区和语言参数规则

以下三组参数分别只能选择一种:

  • 地区:location_namelocation_codelocation_coordinate
  • 语言:language_namelanguage_code

可通过以下接口获取可用的地区和语言:

text
GET https://api.seermartech.cn/v3/merchant/amazon/locations
GET https://api.seermartech.cn/v3/merchant/amazon/languages

请求示例

cURL

bash
curl --location --request POST \
  "https://api.seermartech.cn/v3/merchant/amazon/products/task_post" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '[
    {
      "location_name": "United States",
      "language_name": "English (United States)",
      "keyword": "shoes"
    },
    {
      "location_name": "United States",
      "language_name": "English (United States)",
      "keyword": "shoes",
      "priority": 2,
      "tag": "some_string_123",
      "pingback_url": "https://your-server.com/pingscript?id=$id&tag=$tag"
    },
    {
      "location_name": "United States",
      "language_name": "English (United States)",
      "keyword": "shoes",
      "postback_data": "html",
      "postback_url": "https://your-server.com/postbackscript"
    }
  ]'

Python

python
import requests

url = "https://api.seermartech.cn/v3/merchant/amazon/products/task_post"

payload = [
    {
        "location_name": "United States",
        "language_name": "English (United States)",
        "keyword": "shoes",
    },
    {
        "location_name": "United States",
        "language_name": "English (United States)",
        "keyword": "shoes",
        "priority": 2,
        "tag": "some_string_123",
        "pingback_url": (
            "https://your-server.com/pingscript?id=$id&tag=$tag"
        ),
    },
    {
        "location_name": "United States",
        "language_name": "English (United States)",
        "keyword": "shoes",
        "postback_data": "html",
        "postback_url": "https://your-server.com/postbackscript",
    },
]

headers = {
    "Authorization": "Bearer smt_live_YOUR_KEY",
    "Content-Type": "application/json",
}

response = requests.post(url, json=payload, headers=headers, timeout=30)
response.raise_for_status()

result = response.json()

if result.get("status_code") == 20000:
    print(result)
else:
    print(
        f"请求失败,错误码:{result.get('status_code')},"
        f"错误信息:{result.get('status_message')}"
    )

TypeScript

typescript
import axios from "axios";

const payload = [
  {
    location_name: "United States",
    language_name: "English (United States)",
    keyword: "shoes",
  },
  {
    location_name: "United States",
    language_name: "English (United States)",
    keyword: "shoes",
    priority: 2,
    tag: "some_string_123",
    pingback_url:
      "https://your-server.com/pingscript?id=$id&tag=$tag",
  },
  {
    location_name: "United States",
    language_name: "English (United States)",
    keyword: "shoes",
    postback_data: "html",
    postback_url: "https://your-server.com/postbackscript",
  },
];

axios
  .post(
    "https://api.seermartech.cn/v3/merchant/amazon/products/task_post",
    payload,
    {
      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 数组已创建任务的信息。创建任务接口不会直接返回商品结果,任务对象中的 resultnull。任务完成后,可通过任务 ID 获取结果,或使用回调地址接收结果。

顶层响应字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger顶层请求状态码。20000 表示成功。完整错误码请参考 /v3/appendix/errors
status_messagestring顶层状态说明。
timestring请求处理耗时,例如 0.1429 sec.
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量。
tasks_errorintegertasks 数组中返回错误的任务数量。
tasksarray已提交任务列表。

tasks 数组字段

字段类型说明
idstring任务唯一标识,UUID 格式。
status_codeinteger任务状态码,通常位于 1000060000 范围。
status_messagestring任务状态说明。
timestring任务处理耗时。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量。创建任务时通常为 0
patharray请求路径信息。
dataobject创建任务时提交的参数。
resultarray任务结果数组。创建任务接口返回时为 null

响应示例

json
{
  "version": "0.1.20200416",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.1429 sec.",
  "cost": 0.003,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": " ಉದाहरण-task-uuid",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.0123 sec.",
      "cost": 0.003,
      "result_count": 0,
      "path": [
        "v3",
        "merchant",
        "amazon",
        "products",
        "task_post"
      ],
      "data": {
        "api": "merchant",
        "function": "products",
        "se": "amazon",
        "language_code": "en_US",
        "location_code": 2840,
        "keyword": "shoes",
        "priority": 2,
        "se_type": "organic",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    }
  ]
}

> 注意:上例中的 id 用于展示字段结构,响应会返回符合 UUID 格式的任务 ID。

错误处理

建议根据顶层 status_code、任务级 status_codestatus_message 分别处理请求异常与单任务异常。

常见:

错误码说明
40006单次请求中的任务数量 100,出限制的任务提交失败。
20000请求成功。

完整错误码列表请参考:

text
/v3/appendix/errors

实用场景

  • 批量提交商品查询任务:按国家、语言和批量抓取亚马逊商品列表,为选品和市场规模评估提供数据。
  • 筛选指定价格区间的商品:使用 price_minprice_max 获取目标价格带的商品,支持竞品价格监控与定价策略制定。
  • 跟踪不同排序规则下的商品排名:通过 sort_by 获取性、价格、评分或新品排序结果,分析商品位置和搜索竞争格局。
  • 按商品分类拆分市场数据:使用 department 分析不同亚马逊商品部门中的竞品数量、商品结构和覆盖。
  • 回调自动接收任务结果:通过 postback_urlpingback_url 将异步任务接数据平台,减少轮询成本并加快报表更新。

统一入口:官网 · LLM API · 控制台