Skip to content

新建模板

适用版本>=v7.0.2506.20250626

接口说明:新建模板,目前仅支持从云文档保存为企业模板

请求说明

请求地址配置域名+/openapi+/v7/kdocs/templates/add
请求方法POST
签名方式KSO-1(配置域名+/openapi不参与签名)
权限要求查询和管理模板库文件(应用授权) kso.kdocs_template.readwrite

请求头(Header)

Header参数类型是否必填说明
Content-Typestring使用:application/json
X-Kso-DatestringRFC1123 格式的日期,例: Wed, 23 Jan 2013 06:43:08 GMT
X-Kso-AuthorizationstringKSO-1 签名值,详见《签名方法》
Authorizationstring授权凭证,格式为:Bearer {access_token}

请求体(Body)

名称类型是否必填说明
namestring模板名称,不带后缀,长度不超过240,不支持"/:*?"<>|"特殊符号
src_drive_idstring云文档驱动盘id,从云文档上传为模板时必传
src_file_idstring云文档id,从云文档上传为模板时必传

请求体示例

json
{
  "name": "string",
  "src_drive_id": "string",
  "src_file_id": "string"
}

响应体(Response)

名称类型说明
dataobject模板基础信息
coverstring模板封面地址
creatorstring模板创建者
ext_attrsarray[object]模板扩展属性
namestring属性名
valuestring属性值
idstring模板id
namestring模板名称
sourcestring模板来源 可选值(Enum):builtin official company_custom private_custom
suffixstring模板后缀
template_fileobject模板所用文件信息
idstring文件id
sourcestring模板文件来源,只有文件来源为yundoc时 才能通过云文档进行编辑,可选值(Enum): yundoc appfile
codeinteger
msgstring人可阅读的文本信息,可能会按不同的语 言或地区返回不同的文本信息。

响应体示例

json
{
  "data": {
    "cover": "string",
    "creator": "string",
    "ext_attrs": [
      {
        "name": "string",
        "value": "string"
      }
    ],
    "id": "string",
    "name": "string",
    "source": "builtin",
    "suffix": "string",
    "template_file": {
      "id": "string",
      "source": "yundoc"
    }
  },
  "code": 0,
  "msg": "string"
}