跳到主要内容
版本:202601

创建主题自定义模板

POST 

/openapi/2026-01/themes/:theme_id/theme-templates

一次调用即创建自定义模板并绑定到对象(商品、专辑);relations 为空则只建不绑。

请求

Path参数

    theme_id string必填

    模板所属主题 ID

请求体必填

    typestring必填

    模板类型,取值之一:productcollectionproduct_collpage

    titlestring必填

    模板显示名称

    relationsstring[]

    绑定对象 ID 数组(商品 / 专辑)。空数组 = 只建不绑

    fromstring

    复制来源模板的 suffix,如 default

    oseidstring

    创建所在的编辑会话 ID

    selected_allint32

    是否按 front_query_params 全选绑定(而不是在 relations 中逐个列出):0 = 否(默认),1 = 是。取 1 时,目标对象集由 front_query_params 圈定

    front_query_params object

    selected_all = 1 时用于圈定目标对象集的筛选条件;其它情况忽略

    search_keywordstring

    圈定目标对象集时的关键词过滤条件;仅在 selected_all = 1 时生效

    collection_idstring

    圈定目标对象集时的专辑过滤条件;仅在 selected_all = 1 时生效

响应

OK

数据结构
    codestring

    错误码

    messagestring

    错误信息

    data object
    theme_template object

    创建出的主题模板。仅 id 有值,其余字段均为空;需要完整信息请调用模板列表接口

    idstring

    模板唯一 ID

    theme_idstring

    所属主题 ID

    store_idstring

    店铺 ID

    doc_idstring

    底层文档(模板文件)ID

    typestring

    模板类型:product(绑定商品的商品详情页)、collection(专辑详情页)、product_coll(绑定专辑的商品详情页)、page(自定义页,旧版兼容)

    titlestring

    模板显示名称

    suffixstring

    模板路由后缀

    fromstring

    模板创建来源(复制源模板的 suffix)

    obj_idstring

    首个绑定对象的 ID(商品 / 专辑 / 自定义页 id);未绑定任何对象时为空。一个模板可绑定多个对象,总数见 count —— 该字段不会列出全部对象

    obj_titlestring

    首个绑定对象的显示标题(与 obj_id 指向同一对象)

    sourcestring

    数据操作来源:该记录由哪个入口写入。只读;与 from(复制自哪个模板)不是一回事

    created_atstring

    创建时间

    updated_atstring

    更新时间

    iconstring

    模板图标 URL

    countstring

    绑定到该模板的对象数量,以十进制字符串返回(如 12),不是数字类型