更新商品#
同步更新单个商品。通过 productId 或 sku 配合 shopId 来定位商品。请提供且仅提供一个标识符;包含两者或两者都不包含的请求将返回 400 Bad Request。
PATCH https://sdkapi.ideal.house/product-import/products
该标识符与 product 对象分开。这允许集成方通过当前 SKU 定位商品,并在同一次请求中更改 SKU。
在更改 SKU 时使用 productId 作为标识符。如果第一次请求更新了 SKU 但其响应丢失,这能确保重试时不会产生歧义。
请求正文#
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
shopId | string | 是 | 由 Ideal House 提供的 Shop ID。 |
productId | string | 条件性 | 用于定位的商品 ID。当省略 sku 时为必填项。 |
sku | string | 条件性 | 用于定位的当前 SKU。当省略 productId 时为必填项。 |
product | object | 是 | 要更新的字段。至少包含一个字段。 |
可编辑的商品字段#
仅更新 product 中包含的字段。
| 字段 | 类型 | 最大长度 | 说明 |
|---|---|---|---|
sku | string | 120 | 新 SKU。它必须在店铺内保持唯一。 |
externalProductId | string | 120 | 外部商品标识符。 |
groupId | string | 120 | 商品组标识符。 |
collectionId | string | 120 | 商品集合标识符。 |
name | string | 255 | 商品名称。 |
title | string | 255 | 商品展示标题。 |
brand | string | 120 | 商品品牌。 |
productType | string | 120 | 您分类体系中的商品类型。 |
normalizedProductType | string | 40 | 标准化商品类型。请与 Ideal House 确认可支持的取值。 |
category | string | 120 | 商品类别。 |
style | string | 120 | 商品风格。 |
color | string | 120 | 商品颜色。 |
availability | string | 40 | 可售状态值。 |
imageUrl | string | 1,000 | 公开 HTTP 或 HTTPS 源图片 URL。 |
previewImageUrl | string | 1,000 | HTTP 或 HTTPS 预览图 URL。 |
productUrl | string | 1,000 | HTTP 或 HTTPS 商品详情 URL。 |
attributes | object | — | 商品属性。当提供时,该对象将替换当前属性对象。 |
status | string | — | 商品状态。更新端点接受 active 或 inactive。 |
以下字段为只读:id、shopId、productCode、createdAt 和 updatedAt。请使用删除端点将商品状态设为 invalid。
按 SKU 更新#
{
"shopId": "shop_123",
"sku": "SKU-10001",
"product": {
"name": "Large Gold Wall Mirror",
"color": "Antique Gold",
"status": "active"
}
}
curl --request PATCH \
'https://sdkapi.ideal.house/product-import/products' \
--header 'Content-Type: application/json' \
--header 'X-Client-Id: <YOUR_CLIENT_ID>' \
--header 'X-Client-Secret: <YOUR_CLIENT_SECRET>' \
--data-raw '{
"shopId": "shop_123",
"sku": "SKU-10001",
"product": {
"name": "Large Gold Wall Mirror",
"color": "Antique Gold",
"status": "active"
}
}'
按商品 ID 更新并更改 SKU#
{
"shopId": "shop_123",
"productId": "product_123",
"product": {
"sku": "SKU-10001-NEW",
"name": "Large Gold Wall Mirror",
"status": "inactive"
}
}
成功的更新将返回 200 OK 以及完整的更新后商品对象。inactive 商品将被保留,并仍可通过“列出商品”端点获取。