创建主题自定义模板
POST/openapi/2026-01/themes/:theme_id/theme-templates
一次调用即创建自定义模板并绑定到对象(商品、专辑);relations 为空则只建不绑。
请求
Path参数
模板所属主题 ID
- application/json
- 请求体
- 示例
请求体必填
模板类型,取值之一:product、collection、product_coll、page
模板显示名称
绑定对象 ID 数组(商品 / 专辑)。空数组 = 只建不绑
复制来源模板的 suffix,如 default
创建所在的编辑会话 ID
是否按 front_query_params 全选绑定(而不是在 relations 中逐个列出):0 = 否(默认),1 = 是。取 1 时,目标对象集由 front_query_params 圈定
front_query_params object
selected_all = 1 时用于圈定目标对象集的筛选条件;其它情况忽略
圈定目标对象集时的关键词过滤条件;仅在 selected_all = 1 时生效
圈定目标对象集时的专辑过滤条件;仅在 selected_all = 1 时生效
{
"type": "string",
"title": "string",
"relations": [
"string"
],
"from": "string",
"oseid": "string",
"selected_all": 0,
"front_query_params": {
"search_keyword": "string",
"collection_id": "string"
}
}
响应
- 200
OK
- application/json
- 数据结构
- 示例
数据结构
错误码
错误信息
data object
theme_template object
创建出的主题模板。仅 id 有值,其余字段均为空;需要完整信息请调用模板列表接口
模板唯一 ID
所属主题 ID
店铺 ID
底层文档(模板文件)ID
模板类型:product(绑定商品的商品详情页)、collection(专辑详情页)、product_coll(绑定专辑的商品详情页)、page(自定义页,旧版兼容)
模板显示名称
模板路由后缀
模板创建来源(复制源模板的 suffix)
首个绑定对象的 ID(商品 / 专辑 / 自定义页 id);未绑定任何对象时为空。一个模板可绑定多个对象,总数见 count —— 该字段不会列出全部对象
首个绑定对象的显示标题(与 obj_id 指向同一对象)
数据操作来源:该记录由哪个入口写入。只读;与 from(复制自哪个模板)不是一回事
创建时间
更新时间
模板图标 URL
绑定到该模板的对象数量,以十进制字符串返回(如 12),不是数字类型
{
"code": "string",
"message": "string",
"data": {
"theme_template": {
"id": "string",
"theme_id": "string",
"store_id": "string",
"doc_id": "string",
"type": "string",
"title": "string",
"suffix": "string",
"from": "string",
"obj_id": "string",
"obj_title": "string",
"source": "string",
"created_at": "string",
"updated_at": "string",
"icon": "string",
"count": "string"
}
}
}