# 获取类目下商品发布规则

调试诊断

接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南

接口英文名:getcategoryproductrule

# 1. 调用方式

# HTTPS 调用

POST https://api.weixin.qq.com/shop/ec/category/getcategoryproductrule?access_token=ACCESS_TOKEN

# 云调用

  • 本接口不支持云调用

# 第三方调用

# 2. 请求参数

# 查询参数 Query String parameters

参数名类型必填示例说明
access_tokenstringACCESS_TOKEN接口调用凭证,可使用 access_token(微信小店商家)、authorizer_access_token(服务商代调用)

# 请求体 Request Payload

参数名类型必填说明
cat_idnumber类目ID
release_modenumber发布模式。0: 普通模式;1: 极简模式

# 3. 返回参数

# 返回体 Response Payload

参数名类型说明
errcodenumber错误码
errmsgstring错误信息
infoobject类目信息
product_attr_listobjarray产品属性
sale_attr_listobjarray销售属性
product_qua_listobjarray资质信息
floor_pricenumber价格下限,单位分,商品售价不可低于此价格
size_chartobject尺码表
product_requirementobject商品编辑要求
extra_service_listobjarray额外服务
is_need_bar_codeboolean 是否必填sku条形码

# Res.info Object Payload

类目信息

参数名类型说明
cat_idnumber类目ID
namestring类目名称

# Res.product_attr_list(Array) Object Payload

产品属性

参数名类型说明
namestring类目必填项名称
valuestring可选项列表,当type为:select_one/select_many时,为选项列表 当type为:integer_unit/decimal4_unit时,为单位的列表
hintstring输入提示,请填写提示语
append_allowedboolean允许添加选项,当type为select_one/select_many时,标识是否允许添加新选项(value中不存在的选项)
type_v2string属性类型v2,共7种类型 string:文本 select_one:单选,选项列表在value中 select_many:多选,选项列表在value中 integer:整数,数字必须为整数 decimal4:小数(4 位精度),小数部分最多 4 位 integer_unit:整数 + 单位,单位的选项列表在value中 decimal4_unit:小数(4 位精度) + 单位,单位的选项列表在value中
required_ruleobject填写规则

# Res.sale_attr_list(Array) Object Payload

销售属性

参数名类型说明
namestring类目必填项名称
valuestring可选项列表,当type为:select_one/select_many时,为选项列表 当type为:integer_unit/decimal4_unit时,为单位的列表
hintstring输入提示,请填写提示语
append_allowedboolean允许添加选项,当type为select_one/select_many时,标识是否允许添加新选项(value中不存在的选项)
type_v2string属性类型v2,共7种类型 string:文本 select_one:单选,选项列表在value中 select_many:多选,选项列表在value中 integer:整数,数字必须为整数 decimal4:小数(4 位精度),小数部分最多 4 位 integer_unit:整数 + 单位,单位的选项列表在value中 decimal4_unit:小数(4 位精度) + 单位,单位的选项列表在value中
required_ruleobject填写规则

# Res.product_qua_list(Array) Object Payload

资质信息

参数名类型说明
idnumber资质ID
tipsstring资质的描述信息
namestring资质名称
required_ruleobject填写规则

# Res.size_chart Object Payload

尺码表

参数名类型说明
is_supportboolean是否支持尺码表
item_listobjarray尺码配置要求列表

# Res.product_requirement Object Payload

商品编辑要求

参数名类型说明
product_title_requirementstring商品标题的编辑要求
product_img_requirementstring商品主图的编辑要求
product_desc_requirementstring商品描述的编辑要求

# Res.extra_service_list(Array) Object Payload

额外服务

参数名类型说明
extra_service_namestring额外服务参数名
extra_service_typestring额外服务参数类型,select_one:单选,选项列表在value中;integer:整数,数字必须为整数
extra_service_valuestring额外服务参数可选值

# Res.product_attr_list(Array).required_rule Object Payload

填写规则

以下参数使用相同结构:

  • Res.sale_attr_list(Array).required_rule : 填写规则
参数名类型说明
rule_typenumber规则类型,1-必填 2-选填 3-条件必填,依赖or_combinators
or_combinatorsobjarray规则组合, 关系固定为or;仅rule_type==3时生效

# Res.product_attr_list(Array).required_rule.or_combinatorsObject Payload

规则组合, 关系固定为or;仅rule_type==3时生效

参数名类型说明
and_combinatorsobject规则组合, 关系固定为and

# Res.product_attr_list(Array).required_rule.or_combinators.and_combinators Object Payload

规则组合, 关系固定为and

参数名类型说明
combine_typenumber组合类型
text_conditionsobjarray检查参数

# Res.product_attr_list(Array).required_rule.or_combinators.and_combinators.text_conditionsObject Payload

检查参数

参数名类型说明枚举
check_fieldnumber检查的字段枚举值
oper_typenumber操作类型枚举值
keywordsarray关键字列表-

# Res.size_chart.item_list(Array) Object Payload

尺码配置要求列表

参数名类型说明
namestring尺码属性名称
unitstring尺码属性值的单位
typestring尺码属性值的类型,1:字符型,2:整数型,3:小数型
is_requiredboolean是否必填
formatstring尺码属性值的填写格式,1:单值填写,2:区间值填写,3:支持单值或区间值
limitstring尺码属性值的限制

# 4. 枚举信息

# Res.product_attr_list(Array).required_rule.or_combinators.and_combinators.text_conditions.check_field Enum

检查的字段

枚举值描述
1商品参数key
2商品参数value
3商品标题

# Res.product_attr_list(Array).required_rule.or_combinators.and_combinators.text_conditions.oper_type Enum

操作类型

枚举值描述
1包含
2不含
3正则

# 5. 注意事项

本接口无特殊注意事项

# 6. 代码示例

请求示例

{
    "cat_id": 546776,
    "release_mode":0
}

返回示例

{
    "errcode": 0,
    "errmsg": "ok",
    "info": {
        "cat_id": "546776",
        "name": "鹅蛋"
    },
    "product_attr_list": [
        {
            "name": "国产/进口",
            "type": "select_one",
            "value": "国产;进口",
            "hint": "",
            "append_allowed": false,
            "type_v2": "select_one",
            "required_rule": {
                "rule_type": 1,
                "or_combinators": []
            }
        },
        {
            "name": "产地",
            "type": "select_one",
            "value": "美国;韩国;日本",
            "hint": "",
            "append_allowed": false,
            "type_v2": "select_one",
            "required_rule": {
                "rule_type": 1,
                "or_combinators": []
            }
        }
    ],
    "sale_attr_list": [],
    "product_qua_list": [
        {
            "id": 1111518,
            "tips": "生鲜肉类产品需提供",
            "name": "动物防疫条件合格证",
            "required_rule": {
                "rule_type": 3,
                "or_combinators": [
                    {
                        "and_combinators": [
                            {
                                "combine_type": 1,
                                "text_conditions": [
                                    {
                                        "check_field": 1,
                                        "oper_type": 1,
                                        "keywords": [
                                            "国产/进口"
                                        ]
                                    },
                                    {
                                        "check_field": 2,
                                        "oper_type": 1,
                                        "keywords": [
                                            "国产"
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        },
        {
            "id": 1111491,
            "tips": "若为进口商品,需提供近一年内的中华人民共和国海关进口货物报关单,展现对应品牌名称及商品名称",
            "name": "报关单",
            "required_rule": {
                "rule_type": 3,
                "or_combinators": [
                    {
                        "and_combinators": [
                            {
                                "combine_type": 1,
                                "text_conditions": [
                                    {
                                        "check_field": 1,
                                        "oper_type": 1,
                                        "keywords": [
                                            "国产/进口"
                                        ]
                                    },
                                    {
                                        "check_field": 2,
                                        "oper_type": 1,
                                        "keywords": [
                                            "进口"
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        }
    ],
    "size_chart": {
        "is_support": false,
        "item_list": []
    },
    "product_requirement": {
        "product_title_requirement": "",
        "product_img_requirement": "",
        "product_desc_requirement": ""
    }
}

# 7. 错误码

此接口没有特殊错误码,可参考 通用错误码;调用接口遇到报错,可使用官方提供的 API 诊断工具 辅助定位和分析问题。

# 8. 适用范围

本接口支持「微信小店」账号类型调用。其他账号类型如无特殊说明,均不可调用。

接口变更日志(2条)
2025 年 12 月 09 日
更新 cat_idrelease_mode 字段描述,新增 extra_service_listis_need_bar_code 字段。
2025 年 11 月 26 日
新增「获取类目下商品发布规则」接口