Product Collection Update API 文档

更新专辑

接口信息

  • 接口地址: {your-site-url}/api/skill/product-collection/update
  • 基础 URL: {your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/apimanager666
  • 请求方式: POST
  • Content-Type: application/json
  • 说明: 此接口用于更新商品专辑

认证

请求头中需要携带 skill-access-token

Header
skill-access-token {your-skill-access-token} (请替换为你自己的 token)

与创建专辑的区别

不同点 创建专辑 更新专辑
id 无此字段 ✅ 必填,指定要更新的专辑
type ✅ 必填 不可更改,更新时无需传入

其余字段与创建专辑一致。


请求参数 (Body - JSON)

基础字段

字段 类型 必填 说明
id int ✅ 必填 专辑 ID
title string ✅ 必填 专辑标题
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 不为空

请求示例

cURL(更新手动专辑)

curl --location --request POST '{your-site-url}/api/skill/product-collection/update' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 363,
    "title": "Sea Sand Dress",
    "handle": "sea-sand-dress",
    "body_html": "<p>Discover our Sea Sand Dress collection...</p>",
    "meta_title": "Sea Sand Dress - Beach Dresses & Summer Resort Wear",
    "meta_keywords": "sea sand dress, beach dress, summer dress",
    "meta_description": "Shop the Sea Sand Dress collection...",
    "image": "/category/15/image/2026/05/11/e1d10f74dbff13c7ae596a008bc5f876.jpg",
    "image_h5": "/category/15/image/2026/05/11/f5421ec4d394443bff4312de9c82817f.jpg",
    "automated_rules": [],
    "template_type": ""
}'

更新自动专辑规则

curl --location --request POST '{your-site-url}/api/skill/product-collection/update' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": 352,
    "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"
        }
    ]
}'

返回结果

code200 表示调用成功;code 不为 200 表示调用失败。

成功响应

{
    "code": 200,
    "data": {
        "id": 363,
        "shop_id": 15,
        "type": 1,
        "handle": "sea-sand-dress",
        "title": "Sea Sand Dress",
        "body_html": "<p>Discover our Sea Sand Dress collection...</p>",
        "meta_is_edit": 2,
        "meta_title": "Sea Sand Dress - Beach Dresses & Summer Resort Wear",
        "meta_keywords": "sea sand dress, beach dress, summer dress",
        "meta_description": "Shop the Sea Sand Dress collection...",
        "image": "/category/15/image/2026/05/11/e1d10f74dbff13c7ae596a008bc5f876.jpg",
        "image_h5": "/category/15/image/2026/05/11/f5421ec4d394443bff4312de9c82817f.jpg",
        "width": 0,
        "height": 0,
        "ratio": 0,
        "width_h5": 0,
        "height_h5": 0,
        "ratio_h5": 0,
        "sort_order": 0,
        "automated_type": 0,
        "translate_type": 3,
        "remote_id": "",
        "custom_url_info": [],
        "template_type": "",
        "automated_rules": [],
        "created_at": "2026-05-11 12:12:20",
        "updated_at": "2026-05-11 12:12:20"
    },
    "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 自动专辑匹配逻辑
data.automated_rules Array[Object] 自动专辑规则数组
data.translate_type int 翻译方式
data.template_type string 模板布局样式
data.remote_id string 远程 ID
data.custom_url_info Array/string 自定义 URL 信息
data.created_at string 创建时间
data.updated_at string 更新时间

注意事项

  1. id 为必填,指定要更新的专辑
  2. 专辑 type(手动/自动)创建后不可更改,更新时无需传入
  3. handle 如果不传则沿用原有值;如果传入且与其他专辑冲突,会自动追加随机后缀
  4. 手动专辑(type=1)的 automated_rules 传空数组即可
  5. MySQL 模式下仅 tag 属性可用;Typesense 引擎模式支持所有属性
Copyright © fecify.com 2025 all right reserved,powered by Gitbook该文件修订时间: 2026-05-11 13:04:58

results matching ""

    No results matching ""