1. 使用说明
欢迎使用“AICC” API 服务。您可以直接通过标准化的 HTTPS 接口,快速实现平台与自有系统的集成,管理平台的数据配置、呼叫控制、通话记录等各种资源。我们同时还提供了 开发者工具套件(SDK),对 API接口调用进行了封装。推荐您优先使用 SDK ,可以更方便地进行系统集成。
2. 接口规范
2.1. 调用方式
2.1.1. 系统接入
通信协议
出于安全考虑,平台只提供 HTTPS 协议访问,只支持服务端调用,不支持浏览器访问。
字符编码
请求及返回结果都使用 UTF-8 字符集编码。
接入地址
-
公有云平台:
-
北京平台:https://api-bj.clink.cn
-
上海平台:https://api-sh.clink.cn
-
-
其它平台: 请咨询技术支持
2.1.2. 公共参数
公共请求参数
每个 API 接口都需要以 URL Parameter 的形式携带公共请求参数,对请求进行鉴权。
名称 | 类型 | 是否必须 | 说明 |
---|---|---|---|
AccessKeyId |
String |
是 |
客服云平台颁发给客户端的访问密钥 ID。 |
Expires |
String |
是 |
签名的有效时间(秒),最小值为 1,最大值为 86400(24 小时)。 |
Timestamp |
String |
是 |
签名的时间戳,格式遵循 ISO 8601 标准,按照格式 “ yyyy-MM-ddTHH:mm:ssZ ” 进行格式化。示例:2018-01-01T12:00:00Z表示北京时间2018年01月01日20点00分00秒 |
Signature |
String |
是 |
根据请求参数和访问密钥计算的签名。 |
请求示例
https://api-bj.clink.cn/xxxxxx?
&AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af
&Expires=60
&Timestamp=2018-09-11T12:02:34Z
&Signature=A4GDuUoWiFj59wQ0Bfq%2FJnB%2BSRU%3D
...
公共返回参数
名称 | 类型 | 说明 |
---|---|---|
requestId |
String |
请求 ID。无论请求 API 服务是否成功,客服云平台都会返回每个请求的唯一 ID 到客户端。 |
2.1.3. 签名机制
签名(Signature)的计算需要使用访问密钥对:AccessKeyId/AccessKeySecret。访问密钥对可以通过登录系统管理后台,在【系统管理-系统对接-接口密钥】模块自助生成。每个访问密钥对可以设置不同的接口访问控制权限。
签名算法
签名(Signature)用于对 API 请求进行身份认证和鉴权,每个请求必须具有唯一的签名。 签名的具体实现是以 AccessKeySecret 为密钥,使用 hmac-sha1 算法对用户请求参数(QueryString)、访问密钥ID(AccessKeyId)、签名有效时间(Expires)、签名当前时间戳(Timestamp)做哈希计算。 具体步骤如下:
1. GET示例:
https://api-bj.clink.cn/cc/list_clients?
AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af
&Expires=60
&Timestamp=2018-10-12T10:18:12Z
&limit=10
&offset=0
&qno=0000
&cnos[0]=0000
&cnos[1]=0001
拼接要加密的字符串规则:请求方法(GET)+ 请求域名(api-bj.clink.cn)+ 请求参数。其中,访问密钥ID(AccessKeyId)、签名有效时间(Expires)、签名时间戳(Timestamp)分别与上面的公共请求参数相对应,请求参数具体拼接规则为:
-
首先对用户请求参数的 name 进行字典排序
AccessKeyId,Expires,Timestamp,cnos[0],cnos[1],limit,offset,qno
-
通过&符号连接用户请求参数的 name 和 value
AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af&Expires=60&Timestamp=2018-10-12T10:18:12Z&&cnos[0]=0000&cnos[1]=0001&limit=10&offset=0&qno=0000
-
Timestamp为UTC时间格式,所有请求参数都要进行UrlEncode
2018-10-12T10:18:12Z => 2018-10-12T10%3A18%3A12Z
cnos[0] => cnos%5B0%5D
cnos[1] => cnos%5B1%5D
-
参数urlParam结果
GETapi-bj.clink.cn/cc/list_clients?AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af&Expires=60&Timestamp=2018-10-12T10%3A18%3A12Z&cnos%5B0%5D=0000&cnos%5B1%5D=0001&limit=10&offset=0&qno=0000
-
计算Signature
Signature = URLEncode(base64(hmac-sha1(AccessKeySecret, urlParam)))
-
最终请求地址
https://api-bj.clink.cn/cc/list_clients?
AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af
&Expires=60
&Timestamp=2018-10-12T10%3A18%3A12Z
&limit=10
&offset=0
&qno=0000
&cnos%5B0%5D
&cnos%5B1%5D
&Signature=pDS5pcYkw3SqQV0zk312iCaQJpg%3D
2. POST示例:
https://api-bj.clink.cn/cc/online?
AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af
&Expires=60
&Timestamp=2018-10-12T10:18:12Z
请求体
{
"qno":"0000",
"cnos":["0000","0001"],
"bindTel":"138xxxx8888",
"bindType":1,
"status":1
}
拼接要加密的字符串规则:请求方法(POST)+ 请求域名(api-bj.clink.cn)+ 请求参数(由于POST方法URL中只有公共参数,其他参数通过请求体传递,所以计算签名时只需考虑公共参数)。其中,访问密钥ID(AccessKeyId)、签名有效时间(Expires)、签名时间戳(Timestamp)分别与上面的公共请求参数相对应,请求参数具体拼接规则为:
-
首先对用户请求参数的 name 进行字典排序
AccessKeyId,Expires,Timestamp
-
通过&符号连接用户请求参数的 name 和 value
AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af&Expires=60&Timestamp=2018-10-12T10:18:12Z
-
Timestamp为UTC时间格式,所有请求参数都要进行URL转码
2018-10-12T10:18:12Z => 2018-10-12T10%3A18%3A12Z
-
参数urlParam结果
POSTapi-bj.clink.cn/cc/online?AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af&Expires=60&Timestamp=2018-10-12T10%3A18%3A12Z
-
计算Signature
Signature = URLEncode(base64(hmac-sha1(AccessKeySecret, urlParam)))
-
最终请求地址
https://api-bj.clink.cn/cc/online?
AccessKeyId=b1fcdc6c62be261cf97b00b25be6a2af
&Expires=60
&Timestamp=2018-10-12T10%3A18%3A12Z
&Signature=pDS5pcYkw3SqQV0zk312iCaQJpg%3D
|
2.2. 返回结果
API 的返回结果统一为 JSON 格式,使用 UTF-8 字符集编码。为了方便阅读,文中的示例有换行和缩进处理,实际返回结果无换行和缩进处理。
正常返回示例
接口调用成功后,会返回接口调用结果和请求 ID(requestId),HTTP 状态码为 2xx。
示例
{
"requestId": "c4bc3588-29bd-44be-91d4-d846c8eea64f"
}
分页示例:
{
"requestId": "77efcfd8-db8c-4f5c-bdb8-d804cfce7423",
"pageNumber": 1,
"pageSize": 10,
"totalCount": 2,
"objects": [
{
"field1":"value1",
"field2":"value2"
},
{
"field3":"value3",
"field4":"value4"
}
]
}
异常返回示例
接口调用失败或出错后,会返回错误码、错误信息和请求 ID,HTTP 状态码为 4xx 或 5xx。
您可以根据接口错误码和错误信息排查错误。当您无法排查错误时,可以联系我们的技术支持,并提供 requestId。
示例
{
"requestId": "778a71c5-7f62-4bbf-b5c2-383a71227b67",
"error": {
"code": "ResourceNotFound",
"message": "指定的资源不存在"
}
}
2.3. IP白名单
您可以在【系统管理-系统对接-IP白名单】模块中设置对接系统的 IP 白名单,进一步提高数据安全性。如果设置了 IP 白名单,系统只会对指定的 IP 提供 API 服务。系统支持两种 IP 格式:
-
指定 IP 地址,如:10.10.1.1 。
-
指定 IP 地址段,如:10.10.1.* - 10.10.2.* 。
2.4. 错误码说明
错误码分为两种类型:
-
客户端错误:该类型错误由客户端引起,例如无效的请求参数、用户没有权限访问资源等。
-
服务器错误:该类型错误在服务端产生,由系统异常引起,没有固定的类型。
示例
{
"requestId": "842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"error": {
"code": "ResourceNotFound",
"message": "指定的资源不存在"
}
}
2.4.1. 客户端错误
本节列出了所有操作都可能返回的常见客户端错误。
code | HTTP Status | message |
---|---|---|
AuthFailure |
401 |
身份验证失败。 |
InvalidParameter |
400 |
请求中指定的参数无效,不受支持或无法使用。 返回的消息提供了错误值的说明。 |
MissingParameter |
400 |
请求缺少必需参数。 |
ResourceNotFound |
404 |
请求资源不存在。 |
MissingRequestBody |
400 |
缺少请求body。 |
MissingAuthenticationToken |
400 |
请求必须包含有效的访问密钥ID。 |
HttpMediaTypeNotSupported |
400 |
HttpMediaType不支持,只支持application/json |
HttpRequestMethodNotSupported |
405 |
HTTP方法不支持。 |
UnauthorizedOperation |
403 |
您无权执行此操作。请确认您的密钥ID有此权限 |
UnknownParameter |
400 |
提供了未知或未识别的参数。 |
SignaturesExpired |
403 |
签名过期 |
TooManyRequests |
429 |
请求超限 |
2.4.2. 服务器错误
code | HTTP Status | message |
---|---|---|
InternalError |
500 |
发生内部错误。 重试您的请求,但如果问题仍然存在,请联系技术支持。 |
3. 知识库管理接口
3.1. 获取公共知识库列表
GET /aikb/list_public_repositories
请求参数
名称 |
类型 |
是否必需 |
描述 |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
知识库ID |
name |
String |
知识库名称 |
createUser |
String |
创建人 |
updateUser |
String |
更新人 |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
updateTime |
String |
更新时间,格式yyyy/MM/dd HH:mm:ss |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"result": [
{
"id": 1,
"name": "lucy-知识库",
"createTime": "2024/03/29 09:47:46",
"updateTime": "2024/03/29 09:47:46",
"createUser": "lucy",
"updateUser": "lucy"
},
{
"id": 2,
"name": "lhc测试",
"createTime": "2024/04/07 13:50:30",
"updateTime": "2024/05/22 11:54:07",
"createUser": "lucy",
"updateUser": "lucy"
}
]
}
3.2. 获取个人知识库列表
GET /aikb/list_private_repositories
请求参数
名称 |
类型 |
是否必需 |
描述 |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
知识库ID |
name |
String |
知识库名称 |
owner |
String |
知识库拥有者 |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"result": [
{
"id": 1,
"name": "个人知识库",
"createTime": "2024/03/27 16:00:37",
"owner": "tom"
},
{
"id": 2,
"name": "个人知识库",
"createTime": "2024/03/27 17:50:23",
"owner": "lili"
}
]
}
3.3. 获取机器人知识库信息
GET /aikb/describe_bot_repository
请求参数
名称 |
类型 |
是否必需 |
描述 |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
知识库ID |
name |
String |
知识库名称 |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"result": {
"id": 1,
"name": "机器人专用",
"createTime": "2024/03/27 16:55:16"
}
}
4. 目录管理接口
4.1. 获取目录列表
GET /aikb/list_directory_tree
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
botId |
Integer |
false |
目录绑定的机器人ID |
type |
String |
true |
目录所属知识类型;FAQ:问答库,FILE:文档库 |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
目录ID |
repositoryId |
Integer |
知识库ID |
name |
String |
目录名称 |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
updateTime |
String |
更新时间,格式yyyy/MM/dd HH:mm:ss |
createUser |
String |
创建人 |
updateUser |
String |
更新人 |
subDirectories |
Object[] |
子目录 返回参数 |
返回示例
{
"requestId": "118f0d01-2c07-4f0e-a6ba-8c7f90f2e387",
"result": [
{
"id": 155184,
"name": "abc",
"repositoryId": 102169,
"type": "FAQ",
"createTime": "2024/05/31 11:59:58",
"updateTime": null,
"createUser": "aaa",
"updateUser": "aaa",
"subDirectories": [
{
"id": 155886,
"name": "b1",
"repositoryId": 102169,
"type": "FAQ",
"createTime": "2024/06/07 22:23:26",
"updateTime": null,
"createUser": "aaa",
"updateUser": "aaa",
"subDirectories": [
{
"id": 155887,
"name": "b10",
"repositoryId": 102169,
"type": "FAQ",
"createTime": "2024/06/07 22:23:31",
"updateTime": null,
"createUser": "aaa",
"updateUser": "aaa",
"subDirectories": null
}
]
}
]
},
{
"id": 155894,
"name": "l1",
"repositoryId": 102169,
"type": "FILE",
"createTime": "2024/06/07 22:29:46",
"updateTime": null,
"createUser": "zhangxy",
"updateUser": "zhangxy",
"subDirectories": null
}
]
}
4.2. 创建目录
POST /aikb/save_directory
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
name |
String |
true |
目录名称 |
type |
String |
true |
目录所属知识类型;FAQ:问答库,FILE:文档库 |
parentId |
Integer |
false |
上级目录ID |
示例
请求URL
RequestBody请求参数
{
"repositoryId":103681,
"name":"openapi测试",
"type":"FAQ",
"parentId":103680
}
https://api-bj.clink.cn/aikb/create_directory
&<公共请求参数>
返回参数
名称 |
类型 |
描述 |
id |
Integer |
目录ID |
返回示例
{
"requestId": "118f0d01-2c07-4f0e-a6ba-8c7f90f2e387",
"id": 160178
}
4.3. 修改目录
POST /aikb/edit_directory
请求参数
名称 |
类型 |
是否必需 |
描述 |
directoryId |
Integer |
true |
目录ID |
targetRepositoryId |
Integer |
false |
目标知识库ID(移动目录后归属的知识库ID) |
name |
String |
false |
目录名称 |
targetDirectoryId |
Integer |
false |
目标父目录ID(移动目录后归属的目录ID。若不填,默认移动到目标知识库的根目录下) |
示例
请求URL
RequestBody请求参数
{
"targetRepositoryId":100988,
"name":"test22222",
"directoryId":162399,
"targetDirectoryId":160836
}
https://api-bj.clink.cn/aikb/edit_directory
&<公共请求参数>
返回参数
名称 |
类型 |
描述 |
id |
Integer |
目录ID |
返回示例
{
"requestId": "118f0d01-2c07-4f0e-a6ba-8c7f90f2e387",
"id": 162399
}
5. 知识管理接口
5.1. 获取问答列表
POST /aikb/list_faqs
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
botId |
Integer |
false |
问答绑定的机器人ID |
updateTimeStart |
String |
false |
更新时间范围的开始范围,闭区间,格式yyyy/MM/dd HH:mm:ss。 需要和updateTimeEnd一致,必须都有值或者都没有值。 |
updateTimeEnd |
String |
false |
更新时间范围的结束范围,开区间,格式yyyy/MM/dd HH:mm:ss。 需要和updateTimeStart一致,必须都有值或者都没有值。 |
offset |
Integer |
true |
偏移量,默认值为 0,最大范围 10000 |
limit |
Integer |
true |
查询记录条数,默认值为 10,最大范围 100 |
返回参数
名称 |
类型 |
描述 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
faqs |
Object[] |
问答列表 |
faqs
名称 |
类型 |
描述 |
repositoryId |
Integer |
知识库ID |
directoryId |
Integer |
目录ID |
id |
Integer |
问答ID |
question |
Integer |
问答标题 |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
updateTime |
String |
更新时间,格式yyyy/MM/dd HH:mm:ss |
updateUser |
String |
修改用户 |
createUser |
String |
创建用户 |
onlineDateFrom |
String |
问答有效开始时间,格式yyyy/MM/dd HH:mm:ss |
onlineDateTo |
String |
问答有效结束时间,格式yyyy/MM/dd HH:mm:ss |
answers |
Object[] |
答案列表 |
similars |
Object[] |
相似问列表 |
answers
名称 |
类型 |
描述 |
content |
String |
答案内容 |
type |
String |
答案类型; text:普通文本,html:富文本 |
similars
名称 |
类型 |
描述 |
question |
String |
问答标题 |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"result": [
{
"repositoryId": 1,
"directoryId": 2,
"id": 3,
"question": "知识标签",
"createTime": "2024/06/11 09:06:25",
"updateTime": "2024/06/12 14:19:04",
"createUser": "lucy",
"updateUser": "lucy",
"onlineDateFrom": null,
"onlineDateTo": null,
"answers": [
{
"content": "2222",
"type": "text"
}
],
"similars": [
{
"question": "知识标签"
}
]
}
],
"pageNumber": 1,
"pageSize": 10,
"totalCount": 1
}
5.2. 创建问答
POST /aikb/create_faq
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
directoryId |
Integer |
true |
目录ID |
question |
String |
true |
问答标题 |
answers |
Object[] |
true |
答案列表 |
introductionType |
Integer |
false |
简介类型 1:普通文本,2:富文本 |
introduction |
String |
false |
简介 |
similars |
String[] |
false |
相似问 |
relatedIds |
Integer[] |
false |
关联问知识ID |
onlineDateFrom |
String |
false |
问答有效开始时间,格式yyyy/MM/dd HH:mm:ss |
onlineDateTo |
String |
false |
问答有效结束时间,格式yyyy/MM/dd HH:mm:ss |
answers
名称 |
类型 |
是否必需 |
描述 |
content |
String |
true |
答案内容 |
type |
String |
true |
答案类型; text:普通文本,html:富文本 |
示例
请求URL
https://api-bj.clink.cn/aikb/create_faq
?<公共请求参数>
RequestBody请求参数
{
"repositoryId": 103681,
"directoryId": 160178,
"question": "问题",
"answers": [
{
"content": "答案",
"type": "text"
}
],
"introductionType": 1,
"introduction": "简介",
"similars": [
"相似问"
],
"relatedIds": [
1557362
],
"onlineDateFrom": "2024/06/20 10:00:00",
"onlineDateTo": "2024/06/26 10:00:00"
}
返回参数
名称 |
类型 |
描述 |
id |
Integer |
问答ID |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"id": 1557363
}
5.3. 编辑问答
POST /aikb/edit_faq
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
问答ID |
repositoryId |
Integer |
true |
知识库ID |
directoryId |
Integer |
true |
目录ID |
question |
String |
true |
问答标题,相同目录下问题名称不能重复 |
answers |
Object[] |
true |
答案列表,覆盖更新 |
introductionType |
Integer |
false |
简介类型 1:普通文本,2:富文本,默认是1 |
introduction |
String |
false |
简介 |
similars |
String[] |
false |
相似问,覆盖更新,字段未传或为空数组表示删除相似问 |
relatedIds |
Integer[] |
false |
关联问知识ID,覆盖更新,字段未传或为空数组表示删除关联问 |
onlineDateFrom |
String |
false |
问答有效开始时间,格式yyyy/MM/dd HH:mm:ss |
onlineDateTo |
String |
false |
问答有效结束时间,格式yyyy/MM/dd HH:mm:ss |
answers
名称 |
类型 |
是否必需 |
描述 |
content |
String |
true |
答案内容 |
type |
String |
true |
答案类型; text:普通文本,html:富文本 |
示例
请求URL
https://api-bj.clink.cn/aikb/edit_faq
?<公共请求参数>
RequestBody请求参数
{
"id": 1557363,
"repositoryId": 103681,
"directoryId": 160178,
"question": "问题",
"answers": [
{
"content": "答案",
"type": "text"
}
],
"introductionType": 1,
"introduction": "简介",
"similars": [
"相似问"
],
"relatedIds": [
1557362
],
"onlineDateFrom": "2024/06/20 10:00:00",
"onlineDateTo": "2024/06/26 10:00:00"
}
返回参数
名称 |
类型 |
描述 |
id |
Integer |
问答ID |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"id": 1557363
}
5.4. 删除问答
POST /aikb/delete_faq
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
问答ID |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
问答ID |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"id": 1576554
}
5.5. 问答详情
POST /aikb/describe_faq
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
问答ID |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
问答ID |
repositoryId |
Integer |
知识库ID |
directoryId |
Integer |
目录ID |
question |
String |
问答标题 |
introductionType |
Integer |
简介类型 1:普通文本,2:富文本 |
introduction |
String |
简介 |
relatedIds |
Integer[] |
关联问知识ID |
onlineDateFrom |
String |
问答有效开始时间,格式yyyy/MM/dd HH:mm:ss |
onlineDateTo |
String |
问答有效结束时间,格式yyyy/MM/dd HH:mm:ss |
createTime |
String |
问答创建时间,格式yyyy/MM/dd HH:mm:ss |
updateTime |
String |
问答修改时间,格式yyyy/MM/dd HH:mm:ss |
createUser |
String |
问答创建人 |
updateUser |
String |
问答修改人 |
similars |
Object[] |
相似问 |
answers |
Object[] |
答案列表 |
attachments |
Object[] |
问题答案对应的附件列表 |
introductionAttachments |
Object[] |
简介对应的附件列表 |
similars
名称 |
类型 |
描述 |
question |
String |
问答标题 |
answers
名称 |
类型 |
描述 |
id |
Integer |
答案ID |
content |
String |
答案内容 |
type |
String |
答案类型; text:普通文本,html:富文本 |
attachments
名称 |
类型 |
描述 |
fileKey |
String |
文件key |
fileName |
String |
文件名称 |
introductionAttachments
名称 |
类型 |
描述 |
fileKey |
String |
文件key |
fileName |
String |
文件名称 |
返回示例
{
"result": {
"repositoryId": 103700,
"directoryId": 160364,
"id": 1576463,
"question": "环保标准",
"introduction": "环保标准",
"introductionType": 1,
"createTime": "2024/08/01 10:02:45",
"updateTime": "2024/08/02 09:44:53",
"createUser": "admin",
"updateUser": "admin",
"onlineDateFrom": "2024/08/01 06:00:00",
"onlineDateTo": "2024/08/24 16:00:52",
"answers": [
{
"content": "<p>零售、工程、家装各环保标准根据客户订购的产品会有所不同,不直接答复客户是什么级别。感谢您使用金牌衣柜,我司板材环保标准符合国标ENF环保标准,甲醛释放量≤0.025mg/m³;使用的是万华MDI无醛添加胶水;感谢您使用金牌厨柜,我司板材环保标准符合欧洲E1级环保标签,国标E0级,甲醛释放量≤0.05mg/m。<a style=\"color: #4385ff;\" href=\"fileKey=file/attachment/material/8001678/6229989308c54764a9797d314321fa4b.xlsx&fileName=问答库导入模板 (8).xlsx\" target=\"_blank\" rel=\"noopener\" download=\"download\">模板.xlsx</a><img src=\"fileKey=file/attachment/material/8001678/439d28edeb374851b080ba2430889f8b.png&fileName=20240627090506.png\" /></p>",
"type": "html",
"id": 161634
}
],
"similars": [
{
"question": "相似问"
},
{
"question": "环保标准"
}
],
"relatedIds": [
1557980
],
"attachments": [
{
"fileKey": "file/attachment/material/8001678/439d28edeb374851b080ba2430889f8b.png",
"fileName": "20240627090506.png"
},
{
"fileKey": "file/attachment/material/8001678/6229989308c54764a9797d314321fa4b.xlsx",
"fileName": "模板.xlsx"
}
]
},
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a"
}
6. 文档管理接口
6.1. 获取文档列表
POST /aikb/list_files
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
directoryId |
Integer |
false |
目录ID |
createTimeStart |
String |
false |
创建时间范围的开始范围,闭区间,格式yyyy/MM/dd HH:mm:ss。 需要和createTimeEnd一致,必须都有值或者都没有值。 |
createTimeEnd |
String |
false |
创建时间范围的结束范围,开区间,格式yyyy/MM/dd HH:mm:ss。 需要和createTimeStart一致,必须都有值或者都没有值。 |
updateTimeStart |
String |
false |
更新时间范围的开始范围,闭区间,格式yyyy/MM/dd HH:mm:ss。 需要和updateTimeEnd一致,必须都有值或者都没有值。 |
updateTimeEnd |
String |
false |
更新时间范围的结束范围,开区间,格式yyyy/MM/dd HH:mm:ss。 需要和updateTimeStart一致,必须都有值或者都没有值。 |
offset |
Integer |
true |
偏移量,默认值为 0,最大范围 10000 |
limit |
Integer |
true |
查询记录条数,默认值为 10,最大范围 100 |
返回参数
名称 |
类型 |
描述 |
result |
Object[] |
文件列表 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
result
名称 |
类型 |
描述 |
id |
Integer |
文件ID |
enterpriseId |
Integer |
企业ID |
name |
String |
文件名称 |
repositoryId |
Integer |
知识库ID |
directoryId |
Integer |
目录ID |
approveStatus |
String |
审核状态: |
introduction |
String |
文档说明 |
likeCount |
Integer |
点赞数量 |
dislikeCount |
Integer |
点踩数量 |
searchCount |
Integer |
搜索数量 |
size |
Integer |
文件大小(单位:字节) |
type |
String |
文件类型(txt,jpg,doc等) |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
updateTime |
String |
更新时间,格式yyyy/MM/dd HH:mm:ss |
createUser |
String |
创建用户的用户名 |
updateUser |
String |
修改用户的用户名 |
fileStatus |
String |
文件状态: |
qaRecallRuleId |
Integer |
召回规则ID |
recallRuleName |
String |
召回规则名称 |
effectiveStatus |
String |
有效状态: |
tags |
Object[] |
知识标签列表 |
tags
名称 |
类型 |
描述 |
id |
Integer |
知识标签ID |
name |
String |
知识标签名称 |
返回示例
{
"result": [
{
"id": 18396,
"enterpriseId": 8001678,
"name": "大是非得失.txt",
"repositoryId": 104482,
"directoryId": 178106,
"approveStatus": null,
"introduction": "",
"likeCount": 0,
"dislikeCount": 0,
"searchCount": 0,
"size": 36,
"type": "txt",
"createTime": "2025/03/07 17:03:29",
"updateTime": "2025/03/14 14:39:39",
"createUser": "xxx",
"updateUser": "xxx",
"fileStatus": "QA_ONLINE_SUCCESS",
"qaRecallRuleId": null,
"recallRuleName": null,
"effectiveStatus": "EFFECTIVE",
"tags": []
},
{
"id": 18335,
"enterpriseId": 8001678,
"name": "水电费发带规则生11的.txt",
"repositoryId": 104482,
"directoryId": 178106,
"approveStatus": null,
"introduction": "人多刚发的",
"likeCount": 0,
"dislikeCount": 0,
"searchCount": 0,
"size": 58,
"type": "txt",
"createTime": "2025/03/05 12:04:38",
"updateTime": "2025/03/27 14:26:45",
"createUser": "xxx",
"updateUser": "xxx",
"fileStatus": "QA_ONLINE_SUCCESS",
"qaRecallRuleId": 3,
"recallRuleName": "召回规则1",
"effectiveStatus": "EFFECTIVE",
"tags": [
{
"id": 100504,
"name": "测试1"
},
{
"id": 100726,
"name": "小明1"
}
]
}
],
"pageNumber": 1,
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"pageSize": 10,
"totalCount": 2
}
6.2. 获取文档详情
POST /aikb/describe_file
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
文档ID |
返回参数
名称 |
类型 |
描述 |
result |
Object |
文件详情 |
result
名称 |
类型 |
描述 |
id |
Integer |
文件ID |
enterpriseId |
Integer |
企业ID |
name |
String |
文件名称 |
repositoryId |
Integer |
知识库ID |
directoryId |
Integer |
目录ID |
approveStatus |
String |
审核状态: |
introduction |
String |
文档说明 |
likeCount |
Integer |
点赞数量 |
dislikeCount |
Integer |
点踩数量 |
searchCount |
Integer |
搜索数量 |
size |
Integer |
文件大小(单位:字节) |
type |
String |
文件类型(txt,jpg,doc等) |
createTime |
String |
创建时间,格式yyyy/MM/dd HH:mm:ss |
updateTime |
String |
更新时间,格式yyyy/MM/dd HH:mm:ss |
createUser |
String |
创建用户的用户名 |
updateUser |
String |
修改用户的用户名 |
fileStatus |
String |
文件状态: |
qaRecallRuleId |
Integer |
召回规则ID |
recallRuleName |
String |
召回规则名称 |
effectiveStatus |
String |
有效状态: |
tags |
Object[] |
知识标签列表 |
directoryNames |
String[] |
目录名称列表:从一级目录到当前目录 |
tags
名称 |
类型 |
描述 |
id |
Integer |
知识标签ID |
name |
String |
知识标签名称 |
返回示例
{
"result": {
"id": 1001,
"enterpriseId": 10086,
"name": "产品使用手册.pdf",
"repositoryId": 10001,
"directoryId": 2001,
"approveStatus": "APPROVED",
"introduction": "产品使用说明文档",
"likeCount": 10,
"dislikeCount": 2,
"searchCount": 56,
"size": 1024000,
"type": "pdf",
"createTime": "2023/05/01 10:30:00",
"updateTime": "2023/05/10 15:20:00",
"createUser": "张三",
"updateUser": "李四",
"fileStatus": "QA_ONLINE_SUCCESS",
"qaRecallRuleId": 30,
"recallRuleName": "默认召回规则",
"effectiveStatus": "EFFECTIVE",
"tags": [
{
"id": 101,
"name": "产品文档"
},
{
"id": 102,
"name": "使用说明"
}
],
"directoryNames": [
"一级目录",
"二级目录"
]
},
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a"
}
6.3. 创建文档
POST /aikb/create_file
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库 ID |
directoryId |
Integer |
true |
目录 ID |
fileName |
String |
true |
文件名称(包含有效的文件后缀) |
fileUrl |
String |
true |
文件地址 |
introduction |
String |
false |
文档说明 |
tags |
List<Integer> |
false |
文档标签(支持多个标签 ID) |
effectiveFrom |
Date |
false |
文档有效期开始(格式:yyyy-MM-dd HH:mm:ss) |
effectiveTo |
Date |
false |
文档有效期结束(格式:yyyy-MM-dd HH:mm:ss) |
示例
请求URL
https://api-bj.clink.cn/aikb/create_file
?<公共请求参数>
RequestBody请求参数
{
"repositoryId": 1024,
"directoryId": 2048,
"fileName": "常见问题.md",
"fileUrl": "https://examplebucket.oss-cn-hangzhou.aliyuncs.com/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98.md?x-oss-process=image%2Fresize%2Cp_10&x-oss-date=20241115T095058Z&x-oss-expires=3600&x-oss-signature-version=OSS4-HMAC-SHA256&x-oss-credential=LTAI****************%2F20241115%2Fcn-hangzhou%2Foss%2Faliyun_v4_request&x-oss-signature=6e7a*********************************",
"introduction": "常见问题",
"tags": [4096, 5120],
"effectiveFrom": "2025-10-01 00:00:00",
"effectiveTo": "2025-10-07 23:59:59"
}
返回参数
名称 |
类型 |
描述 |
result |
Object |
文件详情 |
result
名称 |
类型 |
描述 |
fileId |
Integer |
文件唯一 ID |
返回示例
{
"requestId": "01049652-6247-4290-9920-8e7d663093de",
"result": {
"fileId": 6144
}
}
6.4. 删除文档
POST /aikb/delete_files
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库 ID |
fileIds |
List<Integer> |
true |
文档 ID(支持同时删除多个文档) |
示例
请求URL
https://api-bj.clink.cn/aikb/delete_files
?<公共请求参数>
RequestBody请求参数
{
"repositoryId": 1024,
"fileIds": [2048, 4096]
}
返回参数
名称 |
类型 |
描述 |
result |
Object |
文件详情 |
result
名称 |
类型 |
描述 |
fileIds |
List<Integer> |
删除的文件 ID |
返回示例
{
"requestId": "344ae3a5-6f50-4e3f-bf73-9d81fb6a7410",
"result": {
"fileIds": [2048, 4096]
}
}
7. 回收站管理接口
7.1. 获取回收站列表
接口说明:只能获取删除时间在30天内的数据
POST /aikb/list_recycled_items
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
deleteUser |
String |
false |
删除人的用户名 |
keyword |
String |
false |
关键词 |
type |
String |
false |
类型:不填默认值为ALL |
offset |
Integer |
true |
偏移量,默认值为 0,最大范围 10000 |
limit |
Integer |
true |
查询记录条数,默认值为 10,最大范围 100 |
示例
请求URL
https://api-bj.clink.cn/aikb/list_recycled_items
?<公共请求参数>
RequestBody请求参数
{
"repositoryId": 104027,
"deleteUser": "zzj",
"keyword": "指导",
"type": "FAQ",
"limit": 10,
"offset": 0
}
返回参数
名称 |
类型 |
描述 |
result |
Object[] |
回收站项目列表 |
result
名称 |
类型 |
描述 |
enterpriseId |
Integer |
企业ID |
repositoryId |
Integer |
知识库ID |
faqId |
Integer |
问答知识ID,当type为FAQ时有值 |
fileId |
Integer |
文档知识ID,当type为FILE时有值 |
directoryId |
Integer |
目录ID |
type |
String |
类型: |
name |
String |
名称 |
deleteUser |
String |
删除人的用户名 |
deleteTime |
String |
删除时间,格式yyyy/MM/dd HH:mm:ss |
返回示例
{
"result": [
{
"enterpriseId": 8001678,
"repositoryId": 104027,
"faqId": null,
"fileId": null,
"directoryId": 179997,
"type": "FAQ",
"name": "删除的丰东股份",
"deleteUser": "xxx",
"deleteTime": "2023/05/01 10:30:00"
},
{
"enterpriseId": 8001678,
"repositoryId": 104027,
"faqId": 1780064,
"fileId": null,
"directoryId": 176617,
"type": "FAQ",
"name": "如何在睡觉和上班之间选择",
"deleteUser": "xxx",
"deleteTime": "2023/05/01 10:30:00"
}
],
"pageNumber": 1,
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"pageSize": 10,
"totalCount": 2
}
8. 知识问答接口
8.1. 会话问答
POST /aikb/chat_conversation_on_open
url参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
username |
String |
true |
提问用户登录名 |
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
content |
String |
true |
消息内容 |
conversationId |
String |
false |
会话 ID,新对话第一条消息不传,且会返回在服务端生成的 ID,对话的后续消息必传,否则会被识别为对话 |
示例
请求URL
https://api-bj.clink.cn/chat_conversation_on_open?username=zhangpc
&<公共请求参数>
RequestBody请求参数
{
"userId":12345,
"content":"呼叫中心",
"conversationId": "a1f3294570a64dc48d153186379cc9ef"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
conversationId |
Integer |
会话 id |
content |
String |
消息内容 |
files |
Object[] |
文档内容 |
faqs |
Object[] |
文本内容 |
createTime |
String |
创建时间 |
messageId |
String |
消息 id |
files
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
知识 id |
name |
String |
知识名称 |
fileKey |
String |
知识文件Key |
faqs
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
知识 id |
name |
String |
知识名称 |
返回示例
{
"result": {
"conversationId": "a1f3294570a64dc48d153186379cc9ef",
"content": "抱歉,我暂时没有找到合适的答案,您可以尝试换种方式提问",
"createTime": "2024-05-30T07:41:46.701+00:00",
"messageId": "1482",
"files": [
{
"id" : 1,
"name" : "知识名称",
"fileKey" : "https://xxxxxxxxxxxxxxxx"
}
],
"faqs": [
{
"id" : 1,
"name" : "知识名称"
}
]
},
"requestId": "842ab2a6-3732-4c03-8ab7-c7f83180fb0c"
}
9. 知识搜索接口
9.1. 问题搜索
POST /aikb/search_knowledge_on_open
url参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
username |
String |
false |
提问用户登录名 |
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
keyword |
String |
false |
搜索关键词 |
orderField |
String |
false |
排序字段;createTime:创建时间,searchCount:热度,likeCount:点赞,updateTime:修改时间,actionCount:浏览量,不传按照默认排序规则 |
knowledgeType |
String |
false |
指定知识类型 可选值 FAQ, FILE |
repositoryIds |
Integer[] |
false |
指定知识库IDs。如果指定了directoryIds,那么知识搜索范围是repositoryIds和directoryIds的交集 |
directoryIds |
Integer[] |
false |
指定目录IDs。如果指定了repositoryIds,那么知识搜索范围是repositoryIds和directoryIds的交集 |
offset |
Integer |
true |
偏移量,默认值从0开始 |
limit |
Integer |
true |
查询记录条数 |
示例
请求URL
https://api-bj.clink.cn/search_knowledge_on_open?username=zhangpc
&<公共请求参数>
RequestBody请求参数
{
"keyword":"呼叫中心",
"orderField":"createTime",
"offset": 0,
"limit": 10
}
返回参数
名称 |
类型 |
描述 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
result |
Object[] |
本页包含的数据,即会话列表 |
result
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
String |
是 |
唯一标识符,表示知识的唯一 ID |
question |
Integer |
是 |
faq知识标题 |
name |
String |
是 |
文档名称 |
repositoryId |
Integer |
否 |
相关文档库的 ID |
directoryId |
Integer |
否 |
相关目录的 ID |
updateTime |
String |
否 |
最后更新时间,以字符串格式表示 |
likeCount |
Integer |
否 |
点赞数,表示此消息被点赞的次数 |
dislikeCount |
Integer |
否 |
踩数,表示此消息被踩的次数 |
liked |
Boolean |
否 |
当前用户是否点赞了此消息 |
searchCount |
Integer |
否 |
搜索次数,表示此消息被搜索到的次数 |
actionCount |
Integer |
否 |
浏览次数,表示此知识被访问的次数 |
answers |
Object[] |
否 |
回答数组,包含此消息的相关回答 |
content |
String |
是 |
消息的主要内容,通常是文本 |
introduction |
String |
否 |
消息的简介或简要介绍 |
directoryNames |
String[] |
否 |
目录名称列表:从一级目录到当前目录 |
objectKey |
String |
是 |
存储对象的键,用于检索消息的内容 |
type |
String |
否 |
文档类型 |
similarList |
String[] |
否 |
相似消息列表,包含与此消息相似的其他消息 |
knowledgeType |
String |
否 |
排序时优先展示的知识类型 |
attachments |
Object[] |
否 |
附件数组,包含与此消息相关的附件 |
answers
名称 | 类型 | 描述 |
---|---|---|
faqId |
Integer |
答案 id |
content |
String |
答案内容 |
type |
String |
答案类型 |
attachments
名称 | 类型 | 描述 |
---|---|---|
fileKey |
String |
文件key |
fileName |
String |
文件名称 |
返回示例
{
"result": [
{
"id": "7284",
"question": null,
"name": "<em>呼叫</em><em>中心</em> (2).docx",
"repositoryId": 102343,
"directoryId": 154541,
"updateTime": "2024/05/29 11:19:31",
"likeCount": null,
"dislikeCount": null,
"liked": null,
"searchCount": 1,
"actionCount": 1,
"answers": null,
"content": null,
"introduction": "",
"directoryNames": [
"一级目录",
"二级目录"
],
"objectKey": "file/attachment/8000376/d2226d9e6aa64c8d9c66e5e176aff51f.docx",
"type": "docx",
"similarList": [],
"knowledgeType": "FILE",
"attachments": [
{
"fileKey": "file/attachment/8000376/d2226d9e6aa64c8d9c66e5e176aff51f.docx",
"fileName": "<em>呼叫</em><em>中心</em> (2).docx"
}
]
},
{
"id": "7277",
"question": null,
"name": "<em>呼叫</em><em>中心</em> (2).doc",
"repositoryId": 102343,
"directoryId": 154524,
"updateTime": "2024/05/28 21:25:07",
"likeCount": null,
"dislikeCount": null,
"liked": null,
"searchCount": 1,
"answers": null,
"content": "<em>呼叫</em><em>中心</em>\n<em>呼叫</em><em>中心</em>是一个专门用于管理和处理大量电话<em>呼叫</em>的集中化客户服务系统。它是一个组织或企业内部的部门或外包服务提供商,致力于通过电话与客户进行沟通、解决问题、提供支持以及进行营销等活动。",
"introduction": "",
"directoryNames": [
"一级目录",
"二级目录"
],
"objectKey": "file/attachment/8000376/cd7da321d80b4a409119c3606fbe7e28.doc",
"type": "doc",
"similarList": [],
"knowledgeType": "FILE",
"attachments": [
{
"fileKey": "file/attachment/8000376/cd7da321d80b4a409119c3606fbe7e28.doc",
"fileName": "<em>呼叫</em><em>中心</em> (2).doc"
}
]
},
{
"id": "7266",
"question": null,
"name": "<em>呼叫</em><em>中心</em> (2).doc",
"repositoryId": 102343,
"directoryId": 154523,
"updateTime": "2024/05/28 21:23:34",
"likeCount": null,
"dislikeCount": null,
"liked": null,
"searchCount": 1,
"answers": null,
"content": "<em>呼叫</em><em>中心</em>\n<em>呼叫</em><em>中心</em>是一个专门用于管理和处理大量电话<em>呼叫</em>的集中化客户服务系统。它是一个组织或企业内部的部门或外包服务提供商,致力于通过电话与客户进行沟通、解决问题、提供支持以及进行营销等活动。",
"introduction": "",
"directoryNames": [
"一级目录",
"二级目录"
],
"objectKey": "file/attachment/8000376/937d7fa538cc4cb4afedbaddc5b33a55.doc",
"type": "doc",
"similarList": [],
"knowledgeType": "FILE",
"attachments": [
{
"fileKey": "file/attachment/8000376/937d7fa538cc4cb4afedbaddc5b33a55.doc",
"fileName": "<em>呼叫</em><em>中心</em> (2).doc"
}
]
},
{
"id": "7500",
"question": null,
"name": "<em>呼叫</em><em>中心</em> (2).doc",
"repositoryId": 102344,
"directoryId": 154517,
"updateTime": "2024/05/30 10:51:43",
"likeCount": null,
"dislikeCount": null,
"liked": null,
"searchCount": 1,
"answers": null,
"content": null,
"introduction": "",
"directoryNames": [
"一级目录",
"二级目录"
],
"objectKey": "file/attachment/8000376/33658a708c3d4a2a92f57b750cda1e8f.doc",
"type": "doc",
"similarList": [],
"knowledgeType": "FILE",
"attachments": [
{
"fileKey": "file/attachment/8000376/33658a708c3d4a2a92f57b750cda1e8f.doc",
"fileName": "<em>呼叫</em><em>中心</em> (2).doc"
}
]
}
],
"pageNumber": 1,
"requestId": null,
"pageSize": 10,
"totalCount": 41
}
10. 媒体预览下载接口
10.1. 文档文件预览或下载
GET /aikb/describe_file_media_url
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
fileId |
Integer |
true |
文件id |
inline |
Boolean |
false |
值为true时时预览反之下载 |
返回参数
名称 |
类型 |
描述 |
url |
String |
媒体Url |
返回示例
{
"url":"https://aikb-prod.oss-cn-beijing.aliyuncs.com/rtf/20221116/6be0d74e9b8743f79d68470b4a9eaba4.png?Expires=1670395217&OSSAccessKeyId=LTAI5tL2sHNds7TJZrt3AZ6V&Signature=QLwmxPha80%2BBKspemPOyQx1YXxA%3D&response-content-disposition=attachment%3B%20filename%3D6be0d74e9b8743f79d68470b4a9eaba4.png"
}
10.2. 问答文件预览或下载
GET /aikb/describe_faq_media_url
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
faqId |
Integer |
true |
问答知识id |
fileKey |
String |
true |
文件ossKey |
inline |
Boolean |
false |
值为true时时预览反之下载 |
示例
请求示例
https://api-bj.clink.cn/aikb/describe_faq_media_url?faqId=12345
&inline=true
&fileKey=rtf/20221116/6be0d74e9b8743f79d68470b4a9eaba4.png
&<公共请求参数>
返回参数
名称 |
类型 |
描述 |
url |
String |
媒体Url |
返回示例
{
"url":"https://aikb-prod.oss-cn-beijing.aliyuncs.com/rtf/20221116/6be0d74e9b8743f79d68470b4a9eaba4.png?Expires=1670395217&OSSAccessKeyId=LTAI5tL2sHNds7TJZrt3AZ6V&Signature=QLwmxPha80%2BBKspemPOyQx1YXxA%3D&response-content-disposition=attachment%3B%20filename%3D6be0d74e9b8743f79d68470b4a9eaba4.png"
}
11. 上传附件接口
11.1. 获取OSS上传签名
POST /aikb/signature_for_upload
接口说明
通过当前signature_for_upload接口可以获得oss签名等相关信息和html内容,其中html内容可用于维护知识答案,但若想让生成的html内容生效,还需手动调用阿里云接口上传资源文件;
具体如下:
将当前接口返回的host作为请求地址,将ossAccessKeyId、signature、policy、key、file作为请求参数,使用multipart/form-data格式请求接口,其中file为要上传的资源文件(注:文件名要避免中文;文件大小限制200M)。
具体接口介绍请参考:
https://help.aliyun.com/zh/oss/user-guide/form-upload?spm=a2c4g.11186623.help-menu-search-31815.d_0
https://help.aliyun.com/zh/oss/developer-reference/postobject
请求参数
名称 |
类型 |
是否必需 |
描述 |
fileName |
String |
是 |
文件名称(包含扩展名) |
示例
请求示例
https://api-bj.clink.cn/aikb/signature_for_upload
&<公共请求参数>
RequestBody请求参数
{
"fileName": "素材图片.png"
}
返回参数
名称 |
类型 |
描述 |
ossAccessKeyId |
String |
OSS 的 AccessKeyId,用于身份验证 |
signature |
String |
签名字符串,用于请求验证(有效期10分钟) |
host |
String |
OSS endpoint,文件上传的目标地址 |
key |
String |
上传的文件的key,该key可用于上传资源文件 |
policy |
String |
策略文本的 Base64 编码 |
rawHtmlContent |
String |
HTML格式的原始文本内容,可在知识导入时作为答案内容 |
escapedHtmlContent |
String |
HTML格式的转义后的文本内容,可在openapi维护知识时使用 |
返回示例
{
"result": {
"ossAccessKeyId": "fdhgfhsdfdsfsdafasd",
"signature": "z+jwY3X+dsagfadsfgfdasasdfas=",
"host": "https://xxx.oss-cn-beijing.aliyuncs.com",
"key": "aikb/temp/8004423/c71d3c1f700c4238a6e0358cce3c8296.png",
"policy": "eyJleHBpAwMF0sWyJzdGFydHMtd2l0Il1dfQ==",
"rawHtmlContent": <img src="share-bj|xxxxx|素材图片.png|aikb/temp/8004423/c71d3c1f700c4238a6e0358cce3c8296.png>,
"escapedHtmlContent": "<img src=\"share-bj|xxxxx|素材图片.png|aikb/temp/8004423/c71d3c1f700c4238a6e0358cce3c8296.png\">"
},
"requestId": null
}