主题
Google Shopping 商品规格结果查询(按任务 ID)
本接口使用 GET 方法,通过任务 ID 获取 Google Shopping 商品规格:
GET https://api.seermartech.cn/v3/merchant/google/product_spec/task_get/advanced/$id
任务提交成功后,可在 30 天重复查询结果。结果查询本身不额外收费,费用在提交任务时产生。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。任务提交后可在 30 天使用该 ID 查询结果。 |
本接口为 GET 请求,无需请求体。
响应说明
接口返回 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 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
product_id | string | Google Shopping 商品 ID。 |
type | string | 搜索引擎数据类型,固定为 shopping_specifications。 |
se_domain | string | 搜索引擎域名。 |
location_code | integer | 地区代码。 |
language_code | string | 语言代码。 |
title | string | 商品标题。 |
description | string | 商品描述。 |
image_url | string | 商品图片 URL。 |
tags | array | 商品标签。 |
check_url | string | 搜索引擎结果页的直接 URL,可用于核验返回数据。 |
datetime | string | 结果获取时间,格式为 年-月-日 时:分:秒 UTC 时差,例如 2019-11-15 12:57:46 +00:00。 |
item_types | array | 商品规格页面中发现的类型,可能 shopping_specification。 |
items_count | integer | items 数组中的数量。 |
items | array | 商品规格页面中的属性及数据。 |
items 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,可能为 shopping_specification。 |
rank_group | integer | 在相同 type素分组中的位置。不同类型不会计算该字段。 |
rank_absolute | integer | 素在商品规格页面中的绝对位置。 |
position | string | 素在页面中的对齐位置,可能为 right。 |
xpath | string | 素在页面中的 XPath。 |
block_name | string | 商品属性区块名称,例如 Universal Product Identifiers。 |
specification_name | string | 商品属性名称,例如 Brand、GTIN。 |
specification_value | string | 商品属性值。 |
请求示例
cURL
bash
id="04171306-0696-0188-0000-98b668ecaf09"
curl --location --request GET \
"https://api.seermartech.cn/v3/merchant/google/product_spec/task_get/advanced/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"TypeScript
typescript
import axios from "axios";
const taskId = "02231453-2604-0066-2000-64d39c6677d4";
axios
.get(
`https://api.seermartech.cn/v3/merchant/google/product_spec/task_get/advanced/${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);
});Python
python
import requests
task_id = "02231453-2604-0066-2000-64d39c6677d4"
url = (
"https://api.seermartech.cn/v3/merchant/google/"
f"product_spec/task_get/advanced/{task_id}"
)
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
if data.get("status_code") == 20000:
print("商品规格结果:", data.get("tasks"))
else:
print(
"请求失败:",
data.get("status_code"),
data.get("status_message"),
)响应示例
json
{
"version": "0.1.20210805",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0943 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "04171306-0696-0188-0000-98b668ecaf09",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0821 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"merchant",
"google",
"product_spec",
"task_get",
"advanced"
],
"data": {
"se_type": "shopping_specifications",
"api": "merchant",
"function": "product_spec",
"se": "google",
"language_code": "en",
"location_code": 2840,
"product_id": "8630889977405722046",
"device": "desktop",
"os": "windows"
},
"result": [
{
"product_id": "8630889977405722046",
"type": "shopping_specifications",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"title": "Apple iPhone 8 Plus",
"description": "",
"image_url": "",
"tags": [],
"check_url": "https://www.google.com/shopping/product/8630889977405722046/specs?hl=en&gl=US",
"datetime": "2021-08-12 08:45:01 +00:00",
"item_types": [
"shopping_specification"
],
"items_count": 3,
"items": [
{
"type": "shopping_specification",
"rank_group": 1,
"rank_absolute": 1,
"position": "right",
"xpath": "/html/body/div/div/div/div/table/tr",
"block_name": "Universal Product Identifiers",
"specification_name": "Brand",
"specification_value": "Apple"
},
{
"type": "shopping_specification",
"rank_group": 2,
"rank_absolute": 2,
"position": "right",
"xpath": "/html/body/div/div/div/div/table/tr",
"block_name": "Universal Product Identifiers",
"specification_name": "Part Numbers",
"specification_value": "364FC3802F6B4DB8A02B0E541E551BE8, A1897, I8P-64-SIL-TMO-E"
},
{
"type": "shopping_specification",
"rank_group": 3,
"rank_absolute": 3,
"position": "right",
"xpath": "/html/body/div/div/div/div/table/tr",
"block_name": "Universal Product Identifiers",
"specification_name": "GTIN",
"specification_value": "00190198456168"
}
]
}
]
}
]
}状态码与异常处理
- 当顶层
status_code为20000时,表示请求处理成功。 - 当任务级
status_code为错误状态时,应优检查对应的status_message。 - 当
tasks_error大于0时,表示至少有一个任务返回错误。 - 建议对 HTTP 状态码、顶层状态码、任务级状态码以及
result是否为空分别进行处理。 - 完整状态码说明请参考本平台错误码文档。
实用场景
- 采集商品规格属性:批量获取品牌、GTIN、型号等结构化字段,完善商品目录和站商品信息。
- 核验商品数据一致性:对比商品页与 Google Shopping 展示的规格信息,及时发现属性缺失或错误。
- 分析竞品商品参数:抓取竞品商品的规格区块和属性值,为竞品研究、选品和定价提供数据支持。
- 构建 SEO 商品数据集:提取商品标题、描述、标签及规格字段,生成结构化和商品落地页数据。
- 监控商品信息变化:定期按任务 ID 获取并比对商品规格结果,识别品牌、型号或识别码等字段变更。