Product Collection Create API 文档
商品专辑创建
接口信息
- 接口地址:
{your-site-url}/api/skill/product-collection/create
- 基础 URL:
{your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/apimanager666
- 请求方式:
POST
- Content-Type:
application/json
- 说明: 此接口用于创建商品专辑,支持手动专辑(指定商品 ID)和自动专辑(通过规则条件匹配)
认证
请求头中需要携带 skill-access-token:
| Header |
值 |
skill-access-token |
{your-skill-access-token} (请替换为你自己的 token) |
请求参数 (Body - JSON)
基础字段
| 字段 |
类型 |
必填 |
说明 |
title |
string |
✅ 必填 |
专辑标题 |
type |
int |
✅ 必填 |
专辑类型。1 手动(勾选商品 ID),2 自动(通过条件匹配商品) |
handle |
string |
选填 |
专辑 URL handle。如果 handle 已存在,会自动追加随机数字后缀 |
body_html |
string |
选填 |
专辑描述(HTML) |
meta_title |
string |
选填 |
SEO 标题。非独立编辑模式下从 title 取值即可 |
meta_keywords |
string |
选填 |
SEO 关键字 |
meta_description |
string |
选填 |
SEO 描述。非独立编辑模式下从 body_html 取值即可 |
template_type |
string |
选填 |
新架构模板下的模板布局样式 |
图片字段
| 字段 |
类型 |
必填 |
说明 |
image |
string |
选填 |
PC 端专辑图片 URL |
width |
int/string |
选填 |
PC 图片宽度(像素) |
height |
int/string |
选填 |
PC 图片高度(像素) |
ratio |
int/string |
选填 |
PC 图片宽高比 |
image_h5 |
string |
选填 |
手机端专辑图片 URL |
width_h5 |
int/string |
选填 |
手机端图片宽度(像素) |
height_h5 |
int/string |
选填 |
手机端图片高度(像素) |
ratio_h5 |
int/string |
选填 |
手机端图片宽高比 |
自动专辑字段(type=2 时使用)
| 字段 |
类型 |
必填 |
说明 |
automated_type |
int |
选填 |
规则匹配逻辑。1 满足全部条件(AND),2 满足任一条件(OR) |
automated_rules |
Array[Object] |
选填 |
自动分类的规则数组(见下方说明) |
translate_type |
int |
选填 |
翻译方式。1 强制翻译,2 只翻译多语言为空的部分,3 不翻译 |
automated_rules 子项
每个规则对象包含三个属性:
{
"key": "tag",
"type": "is_equal_to",
"value": "red"
}
| 字段 |
类型 |
必填 |
说明 |
key |
string |
✅ 必填 |
商品字段属性(见下方支持列表) |
type |
string |
✅ 必填 |
条件类型(见下方支持列表) |
value |
string |
✅ 必填 |
条件值 |
支持的 key(商品属性)
| key 值 |
说明 |
引擎支持 |
title |
商品标题 |
仅 Typesense 搜索引擎 |
tag |
商品 Tag |
MySQL + Typesense |
vendor |
商品厂家/品牌 |
仅 Typesense 搜索引擎 |
collection_ids |
商品专辑 |
仅 Typesense 搜索引擎 |
price |
售价 |
仅 Typesense 搜索引擎 |
compare_at_price |
划线价 |
仅 Typesense 搜索引擎 |
created_at |
创建时间 |
仅 Typesense 搜索引擎 |
在 MySQL 模式下只支持 tag 属性。
各 key 支持的 type 条件
| key |
支持的条件 |
title |
is_equal_to / is_not_equal_to / start_with / ends_with / contains / does_not_contain |
tag |
is_equal_to |
vendor |
is_equal_to / is_not_equal_to / start_with / ends_with / contains / does_not_contain |
collection_ids |
is_equal_to |
price |
is_equal_to / is_not_equal_to / is_greater_than / is_less_than |
compare_at_price |
is_equal_to / is_not_equal_to / is_greater_than / is_less_than / is_empty / is_not_empty |
created_at |
is_equal_to |
type 可选值说明
| type 值 |
说明 |
is_equal_to |
等于 |
is_not_equal_to |
不等于 |
start_with |
开头为 |
ends_with |
结尾为 |
contains |
包含 |
does_not_contain |
不包含 |
is_greater_than |
大于 |
is_less_than |
小于 |
is_empty |
为空 |
is_not_empty |
不为空 |
请求示例
创建自动专辑(按 tag 匹配)
curl --location --request POST '{your-site-url}/api/skill/product-collection/create' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": 2,
"handle": "product-collection-title",
"title": "product collection title",
"body_html": "product collection description",
"meta_title": "product collection title",
"meta_keywords": "keywords product collection title",
"meta_description": "meta product collection title",
"image": "",
"width": "",
"height": "",
"ratio": "",
"image_h5": "",
"width_h5": "",
"height_h5": "",
"ratio_h5": "",
"automated_rules": [
{
"key": "tag",
"type": "is_equal_to",
"value": "red"
}
],
"automated_type": 1,
"template_type": "collection"
}'
创建自动专辑(多条件匹配)
curl --location --request POST '{your-site-url}/api/skill/product-collection/create' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": 2,
"title": "Price Range Collection",
"automated_type": 2,
"automated_rules": [
{
"key": "price",
"type": "is_greater_than",
"value": "10"
},
{
"key": "price",
"type": "is_less_than",
"value": "100"
}
]
}'
返回结果
code 为 200 表示调用成功;code 不为 200 表示调用失败。
成功响应
{
"code": 200,
"data": {
"shop_id": 15,
"type": 2,
"handle": "product-collection-title-w4xhk02y",
"title": "product collection title",
"body_html": "product collection description",
"meta_is_edit": 2,
"meta_title": "product collection title",
"meta_keywords": "keywords product collection title",
"meta_description": "meta product collection title",
"image": "",
"image_h5": "",
"width": 0,
"height": 0,
"ratio": 0,
"width_h5": 0,
"height_h5": 0,
"ratio_h5": 0,
"sort_order": 0,
"automated_type": 1,
"translate_type": 3,
"remote_id": "",
"custom_url_info": "",
"template_type": "collection",
"automated_rules": [
{
"key": "tag",
"type": "is_equal_to",
"value": "red"
}
],
"created_at": "2026-05-09 15:46:39",
"updated_at": "2026-05-09 15:46:39",
"id": 352
},
"message": "success"
}
返回字段说明
| 字段 |
类型 |
说明 |
code |
Number |
状态码,200 表示成功 |
message |
String |
执行结果的文字描述 |
data.id |
int |
创建的专辑 ID |
data.shop_id |
int |
店铺 ID |
data.type |
int |
专辑类型。1 手动,2 自动 |
data.title |
string |
专辑标题 |
data.handle |
string |
专辑 handle(自动生成或用户传入,已存在时追加随机后缀) |
data.body_html |
string |
专辑描述 |
data.meta_title |
string |
SEO 标题 |
data.meta_keywords |
string |
SEO 关键字 |
data.meta_description |
string |
SEO 描述 |
data.meta_is_edit |
int |
SEO 是否独立编辑。1 独立编辑,2 未独立编辑 |
data.image |
string |
PC 端专辑图片 URL |
data.image_h5 |
string |
手机端专辑图片 URL |
data.width |
int |
PC 图片宽度 |
data.height |
int |
PC 图片高度 |
data.ratio |
int/string |
PC 图片宽高比 |
data.width_h5 |
int |
手机端图片宽度 |
data.height_h5 |
int |
手机端图片高度 |
data.ratio_h5 |
int/string |
手机端图片宽高比 |
data.sort_order |
int |
排序值 |
data.automated_type |
int |
自动专辑匹配逻辑。1 满足全部条件,2 满足任一条件 |
data.translate_type |
int |
翻译方式 |
data.automated_rules |
Array[Object] |
自动专辑规则数组 |
data.template_type |
string |
模板布局样式 |
data.remote_id |
string |
远程 ID |
data.custom_url_info |
string |
自定义 URL 信息 |
data.created_at |
string |
创建时间 |
data.updated_at |
string |
更新时间 |
注意事项
type 为必填,1 手动 / 2 自动
- 手动专辑(
type=1)需配合添加商品到专辑的 API 使用
- 自动专辑(
type=2)通过 automated_rules 规则自动匹配商品
handle 如果不传,系统会自动生成;如果传入但已存在,会在末尾追加随机字符
- MySQL 模式下仅
tag 属性可用;Typesense 引擎模式支持所有属性