跳至主要内容

新增文档知识

新增网页或文章知识。

请求​

POST https://apichat.twt.com/openapi/zhishi/create_doc

Header 参数​

参数名类型必填说明
x-chat-signaturestring是HMAC-SHA256 签名
Acceptstring否默认值:application/json
Content-Typestring是application/json

Body 参数​

参数名类型必填说明
appidstring是应用标识
timestampinteger是请求时间戳
ranstrstring是随机字符串
lxinteger是1 表示网页,2 表示文章
urlstring[]网页必填待解析的网页地址,最多 10 条
mcstring文章必填文章标题,1 至 255 个字符
nrstring文章必填文章内容,1 至 2000 个字符

请求示例​

{
"appid": "your-appid",
"timestamp": 1735689600,
"ranstr": "random-string",
"lx": 2,
"mc": "使用入门",
"nr": "欢迎使用本产品。"
}

返回响应​

200 成功​

参数名类型必填说明
codeinteger是1 正常,-1 失败
msgstring是响应信息
data.idinteger是本次新增的主知识库 ID
data.idsinteger[]是本次实际创建的全部 ID;多个网页地址可能创建多条知识
{
"code": 1,
"msg": "ok",
"data": {
"id": 1002,
"ids": [1002]
}
}

错误示例​

{
"code": -1,
"msg": "参数错误",
"data": ""
}