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": 295,
"name": "1111",
"owner": null,
"createTime": "2024/03/28 10:33:52",
"updateTime": "2024/03/28 10:33:52",
"createUser": "abc",
"updateUser": "abc"
},
{
"id": 307,
"name": "哈哈哈",
"owner": null,
"createTime": "2024/03/28 15:19:21",
"updateTime": "2024/05/21 15:51:27",
"createUser": "aaa",
"updateUser": "aaa"
}
]
}
3.2. 获取个人知识库列表
GET /aikb/list_private_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": 286,
"name": "个人知识库",
"owner": "aaa",
"createTime": "2024/03/27 16:00:37",
"updateTime": "2024/03/27 16:00:37",
"createUser": "aaa",
"updateUser": null
},
{
"id": 290,
"name": "个人知识库",
"owner": "bbb",
"createTime": "2024/03/27 17:50:23",
"updateTime": "2024/03/27 17:50:23",
"createUser": "bbb",
"updateUser": null
}
]
}
3.3. 获取机器人知识库信息
GET /aikb/describe_bot_repository
请求参数
名称 |
类型 |
是否必需 |
描述 |
返回参数
名称 |
类型 |
描述 |
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": 287,
"name": "8002573测试灰度专用",
"owner": null,
"createTime": "2024/03/27 16:55:16",
"updateTime": "2024/05/17 11:13:20",
"createUser": "zzz",
"updateUser": "zzz"
}
}
4. 目录管理接口
4.1. 获取目录列表
GET /aikb/list_directories
请求参数
名称 |
类型 |
是否必需 |
描述 |
repositoryId |
Integer |
true |
知识库ID |
botId |
Integer |
false |
目录绑定的机器人ID |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
目录ID |
repositoryId |
Integer |
知识库ID |
name |
String |
目录名称 |
type |
Integer |
目录所属知识类型;QA 问答库,DOCUMENT 文档库,GRAPH 知识图谱 |
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
}
]
}
5. 文章管理接口
5.1. 新增文章
POST /kb/create_article
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
kbId |
Integer |
true |
知识库ID |
kbType |
Integer |
true |
知识库类型;0:问答库,1:文档库 |
directoryId |
Integer |
true |
目录ID |
title |
String |
true |
文章标题;问答库标题不能超过50个字符,文档库标题不能超过250个字符,标题不能重复 |
agentEnabled |
Integer |
true |
座席可用状态;0:已下线,1:已上线 |
similars |
String[] |
false |
相似问题;相似问题数组大小不能大于1000,每个相似问题不能超过100个字符 |
content |
String |
true |
文档库答案;文档库这个属性必填不能为空,问答库不用填 |
topStatus |
Integer |
false |
是否置顶;0:非置顶(默认),1:置顶 |
botId |
String |
false |
机器人ID |
relatedQuestions |
Object[] |
false |
文档库-关联知识点 relatedQuestion 相关字段描述;关联的标题必须是当前知识库下的标题 |
answers |
Object[] |
true |
问答库多个答案 answers 相关字段描述;问答库这个属性必填,答案集合不能为空,且数量不能大于3,文档库不用填 |
请求示例
https://api-bj.clink.cn/kb/create_article
&<公共请求参数>
RequestBody请求参数
{
"kbId":1,
"kbType":0,
"directoryId":2,
"title":"标题",
"similars":[
"标题1",
"标题2"
],
"content":"答案",
"agentEnabled":1,
"topStatus":0,
"botId":null,
"relatedQuestions":null,
"answers": [
{
"answer": "123",
"recommendQuestion": [
],
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions":null
}
]
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
文章ID |
kbId |
Integer |
知识库ID |
kbType |
Integer |
知识库类型;0:问答库,1:文档库 |
directoryId |
Integer |
目录ID |
title |
String |
文章标题 |
agentEnabled |
Integer |
座席可用状态;0:已下线,1:已上线 |
similars |
String[] |
相似问题 |
content |
String |
文档库答案 |
topStatus |
Integer |
是否置顶;0:非置顶,1:置顶 |
botId |
String |
机器人ID |
relatedQuestions |
Object[] |
文档库-关联知识点 relatedQuestion 相关字段描述 |
answers |
Object[] |
问答库多个答案 answers 相关字段描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"article":{
"id": 22,
"kbId":1,
"kbType":0,
"directoryId":2,
"title":"标题",
"similars":[
"标题1",
"标题2"
],
"content":"答案",
"agentEnabled":1,
"topStatus":0,
"botId":null,
"relatedQuestions":null,
"answers": [
{
"answer": "123",
"recommendQuestion": [
],
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions":null
}
]
}
}
5.2. 修改文章
POST /kb/update_article
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
文章ID |
kbId |
Integer |
true |
知识库ID |
kbType |
Integer |
true |
知识库类型;0:问答库,1:文档库 |
directoryId |
Integer |
true |
目录ID |
title |
String |
false |
文章标题;问答库标题不能超过50个字符,文档库标题不能超过250个字符,标题不能重复 |
agentEnabled |
Integer |
false |
座席可用状态;0:已下线,1:已上线 |
similars |
String[] |
false |
相似问题;相似问题数组大小不能大于1000,每个相似问题不能超过100个字符 |
content |
String |
false |
文档库答案;文档库这个属性必填不能为空,问答库不用填 |
topStatus |
Integer |
false |
是否置顶;0:非置顶,1:置顶 |
botId |
String |
false |
机器人ID |
relatedQuestions |
Object[] |
false |
文档库-关联知识点 relatedQuestion 相关字段描述;关联的标题必须是当前知识库下的标题 |
answers |
Object[] |
false |
问答库多个答案 answers 相关字段描述;答案集合数量不能大于3 |
请求示例
https://api-bj.clink.cn/kb/update_article
&<公共请求参数>
RequestBody请求参数
{
"id": 22,
"kbId":1,
"kbType":0,
"directoryId":2,
"title":"标题",
"similars":[
"标题1",
"标题2"
],
"content":"答案",
"agentEnabled":1,
"topStatus":0,
"botId":null,
"relatedQuestions":null,
"answers": [
{
"answer": "123",
"recommendQuestion": [
],
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions":null
}
]
}
返回参数
名称 |
类型 |
描述 |
id |
Integer |
文章ID |
kbId |
Integer |
知识库ID |
kbType |
Integer |
知识库类型;0:问答库,1:文档库 |
directoryId |
Integer |
目录ID |
title |
String |
文章标题 |
agentEnabled |
Integer |
座席可用状态;0:已下线,1:已上线 |
similars |
String[] |
相似问题 |
content |
String |
文档库答案 |
topStatus |
Integer |
是否置顶;0:非置顶,1:置顶 |
botId |
String |
机器人ID |
relatedQuestions |
Object[] |
文档库-关联知识点 relatedQuestion 相关字段描述 |
answers |
Object[] |
问答库多个答案 answers 相关字段描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"article":{
"id": 22,
"kbId":1,
"kbType":0,
"directoryId":2,
"title":"标题",
"similars":[
"标题1",
"标题2"
],
"content":"答案",
"agentEnabled":1,
"topStatus":0,
"botId":null,
"relatedQuestions":null,
"answers": [
{
"answer": "123",
"recommendQuestion": [
],
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions":null
}
]
}
}
5.3. 删除文章
POST /kb/delete_article
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
文章 Id |
返回参数
名称 |
类型 |
描述 |
id |
Integer |
文章ID |
kbId |
Integer |
知识库ID |
kbType |
Integer |
知识库类型;0:问答库,1:文档库 |
directoryId |
Integer |
目录ID |
title |
String |
文章标题 |
agentEnabled |
Integer |
座席可用状态;0:已下线,1:已上线 |
similars |
String[] |
相似问题 |
content |
String |
文档库答案 |
topStatus |
Integer |
是否置顶;0:非置顶,1:置顶 |
botId |
String |
机器人ID |
relatedQuestions |
Object[] |
文档库-关联知识点 relatedQuestion 相关字段描述 |
answers |
Object[] |
问答库多个答案 answers 相关字段描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"article":{
"id": 22,
"kbId":1,
"kbType":0,
"directoryId":2,
"title":"标题",
"similars":[
"标题1",
"标题2"
],
"content":"答案",
"agentEnabled":1,
"topStatus":0,
"botId":null,
"relatedQuestions":null,
"answers": [
{
"answer": "123",
"recommendQuestion": [
],
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions":null
}
]
}
}
5.4. 获取文章列表
GET /kb/list_articles
请求参数
名称 |
类型 |
是否必需 |
描述 |
kbId |
Integer |
false |
知识库 Id |
kbType |
Integer |
true |
知识库类型;0:问答库,1:文档库,2:文件库 |
directoryId |
Integer |
false |
目录 Id |
keyword |
String |
false |
查询的关键字 |
order |
String |
false |
排序字段:NONE 默认顺序,HEAT 热度排序,LIKE 点赞排序,DISLIKE 点踩排序 |
offset |
Integer |
true |
偏移量,默认值为 0,最大范围 10000 |
limit |
Integer |
true |
查询记录条数,默认值为 10,最大范围 100 |
示例
请求URL
https://api-bj.clink.cn/kb/list_articles
?kbId=799
&kbType=0
&order=NONE
&offset=0
&limit=10
&<公共请求参数>
返回参数
名称 |
类型 |
描述 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
articles |
Object[] |
本页包含的数据,即文章集合 articles 相关字段描述 |
articles 相关字段描述
名称 |
类型 |
描述 |
id |
String |
文章ID |
enterpriseId |
String |
企业ID |
title |
String |
标题 |
similars |
String |
相似文章 |
content |
String |
文章内容 |
phoneContent |
String |
电话回复内容 |
onlineContent |
String |
在线回复文章内容 |
wechatContent |
String |
微信回复文章内容 |
appContent |
String |
app回复文章内容 |
webContent |
String |
网页回复文章内容 |
directoryId |
Integer |
目录ID |
kbType |
Integer |
知识库类型;0:问答库,1:文档库,2:文件库 |
kbId |
Integer |
知识库ID |
validDateFrom |
Date |
有效起始日期 |
validDateTo |
Date |
有效终止时间 |
createTime |
Date |
创建时间 |
updateTime |
Date |
更新时间 |
createUser |
String |
创建人 |
updateUser |
String |
更新人 |
accountLoginName |
String |
平台登录名 |
path |
String[] |
目录路径 |
likeCount |
Integer |
文章点赞数量 |
status |
String |
赞踩状态;0:已点赞,1:已点踩,null:未被点击 |
dislikeCount |
Integer |
文章点踩数量 |
answers |
Object[] |
问答库多个答案 answers 相关字段描述 |
botId |
String |
机器人ID |
botTag |
String[] |
机器人配置-标签 |
botAction |
String[] |
机器人配置-标签 |
relatedQuestions |
Object[] |
文档库-关联知识点 relatedQuestion 相关字段描述 |
answers 相关字段描述
名称 |
类型 |
是否必需 |
描述 |
answer |
String |
true |
答案;答案内容不能为空,且答案内容不能大于2000个字符 |
recommendQuestion |
String[] |
false |
推荐问 |
startTime |
String |
false |
开始时间;10位秒级时间戳 |
endTime |
String |
false |
结束时间;10位秒级时间戳 |
transfer |
Integer |
false |
转人工;0:不选中,1:选中 |
relatedQuestions |
Object[] |
false |
问答库-关联知识点 relatedQuestion 相关字段描述;关联的标题必须是当前知识库下的标题 |
relatedQuestion 相关字段描述
名称 |
类型 |
是否必需 |
描述 |
relatedQuestion |
String |
false |
关联标题 |
relatedQuestionId |
String |
false |
关联标题ID |
返回示例
{
"requestId": "447ee3f3-09ee-4396-9c45-313cde6ef84f",
"pageNumber": 1,
"pageSize": 20,
"totalCount": 4,
"articles": [
{
"id": "3629",
"enterpriseId": "1000000",
"title": "11111111",
"similars": null,
"content": null,
"phoneContent": null,
"onlineContent": null,
"wechatContent": null,
"appContent": null,
"webContent": null,
"directoryId": 1234,
"kbType": 0,
"kbId": 111,
"validDateFrom": null,
"validDateTo": null,
"createTime": 1618480885000,
"updateTime": null,
"createUser": "111",
"updateUser": null,
"accountLoginName": "11111",
"path": [
"222",
"333"
],
"likeCount": 2,
"dislikeCount": null,
"status": null,
"answers": [
{
"answer": "123",
"recommendQuestion": [
],
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions": null
}
],
"botId": null,
"botTag": null,
"botAction": null,
"relatedQuestions": null
}
]
}
5.5. 获取文章详情
GET /kb/describe_article
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
String |
true |
文章id(仅问答库与文档库文章id) |
返回参数
名称 |
类型 |
描述 |
id |
String |
文章ID |
enterpriseId |
String |
企业ID |
title |
String |
标题 |
similars |
String |
相似文章 |
content |
String |
文章内容 |
phoneContent |
String |
电话回复内容 |
onlineContent |
String |
在线回复文章内容 |
wechatContent |
String |
微信回复文章内容 |
appContent |
String |
app回复文章内容 |
webContent |
String |
网页回复文章内容 |
directoryId |
Integer |
目录ID |
kbType |
Integer |
知识库类型;0:问答库,1:文档库,2:文件库 |
kbId |
Integer |
知识库ID |
validDateFrom |
Date |
有效起始日期 |
validDateTo |
Date |
有效终止时间 |
createTime |
Date |
创建时间 |
updateTime |
Date |
更新时间 |
createUser |
String |
创建人 |
updateUser |
String |
更新人 |
accountLoginName |
String |
平台登录名 |
path |
String[] |
目录路径 |
likeCount |
Integer |
文章点赞数量 |
status |
String |
赞踩状态;0:已点赞,1:已点踩,null:未被点击 |
dislikeCount |
Integer |
文章点踩数量 |
answers |
Object[] |
问答库多个答案 answers 相关字段描述 |
botId |
String |
机器人ID |
botTag |
String[] |
机器人配置-标签 |
botAction |
String[] |
机器人配置-标签 |
relatedQuestions |
Object[] |
文档库-关联知识点 relatedQuestion 相关字段描述 |
返回示例
{
"requestId": "576565e0-8a69-4ad6-aa9e-e72b9030889c",
"article": {
"id": "3653",
"enterpriseId": "1111111",
"title": "11",
"similars": null,
"content": null,
"phoneContent": null,
"onlineContent": null,
"wechatContent": null,
"appContent": null,
"webContent": null,
"directoryId": 1111,
"kbType": 0,
"kbId": 111,
"validDateFrom": null,
"validDateTo": null,
"createTime": 1625021520000,
"updateTime": null,
"createUser": "111",
"updateUser": null,
"accountLoginName": "a111",
"path": null,
"likeCount": null,
"dislikeCount": null,
"status": null,
"answers": [
{
"answer": "11",
"recommendQuestion": null,
"startTime": null,
"endTime": null,
"transfer": 0,
"relatedQuestions": null
}
],
"botId": null,
"botTag": null,
"botAction": null,
"relatedQuestions": null
}
}
6. 知识管理接口
6.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 |
Integer |
答案类型1:普通文本,2:富文本 |
onlineDateFrom |
String |
答案有效开始时间,格式yyyy/MM/dd HH:mm:ss |
onlineDateTo |
String |
答案有效结束时间,格式yyyy/MM/dd HH:mm:ss |
similars
名称 |
类型 |
描述 |
question |
String |
知识标题 |
返回示例
{
"requestId": "aad87d90-5e6e-4807-92cd-445f9a77ac3a",
"result": [
{
"repositoryId": 287,
"directoryId": 1561,
"id": 1518579,
"question": "知识标签",
"createTime": "2024/06/11 09:06:25",
"updateTime": "2024/06/12 14:19:04",
"createUser": "aaa",
"updateUser": "aaa",
"onlineDateFrom": null,
"onlineDateTo": null,
"answers": [
{
"content": "2222",
"type": "text",
"onlineDateFrom": "2024/06/11 00:00:00",
"onlineDateTo": "2024/06/12 23:59:59"
}
],
"similars": [
{
"question": "知识标签"
}
]
}
],
"pageNumber": 1,
"pageSize": 10,
"totalCount": 1
}
7. 知识问答接口
7.1. 会话问答
POST /aikb/chat_conversation_on_open
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
userId |
Integer |
true |
提问用户 Id |
content |
String |
true |
消息内容 |
conversationId |
String |
false |
会话 ID,新对话第一条消息不传,且会返回在服务端生成的 ID,对话的后续消息必传,否则会被识别为对话 |
示例
请求URL
https://api-bj.clink.cn/chat_conversation_on_open
&<公共请求参数>
RequestBody请求参数
{
"userId":12345,
"content":"呼叫中心",
"conversationId": "a1f3294570a64dc48d153186379cc9ef"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
conversationId |
Integer |
会话 id |
content |
String |
消息内容 |
files |
Object[] |
文档内容 |
faqs |
Object[] |
文本内容 |
createTime |
String |
创建时间 |
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",
"files": [
{
"id" : 1,
"name" : "知识名称",
"fileKey" : "https://xxxxxxxxxxxxxxxx"
}
],
"faqs": [
{
"id" : 1,
"name" : "知识名称"
}
]
},
"requestId": "842ab2a6-3732-4c03-8ab7-c7f83180fb0c"
}
7.2. 会话列表
GET /aikb/list_conversations
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
userId |
Integer |
true |
用户 id |
offset |
Integer |
false |
偏移量,默认值从0开始 |
limit |
Integer |
false |
查询记录条数 |
返回参数
名称 |
类型 |
描述 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
result |
Object[] |
本页包含的数据,即会话列表 |
result
conversationId |
Integer |
会话 id |
title |
String |
会话标题 |
updateTime |
String |
修改时间 |
createTime |
String |
创建时间 |
返回示例
{
"result": [
{
"conversationId": "a1f3294570a64dc48d153186379cc9ef",
"title": "zpcahah",
"createTime": "2024-05-30T07:00:05.572+00:00",
"updateTime": "2024-05-30T07:00:05.572+00:00"
}
],
"pageNumber": 1,
"requestId": null,
"pageSize": 100,
"totalCount": 1
}
7.3. 会话详情
GET /aikb/describe_conversation
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
conversationId |
Integer |
true |
会话 id |
offset |
Integer |
true |
偏移量,默认值从0开始 |
limit |
Integer |
true |
查询记录条数 |
示例
请求URL
https://api-bj.clink.cn/describe_conversation?conversationId=a1f3294570a64dc48d153186379cc9ef
&offset=0
&limit=1000
&<公共请求参数>
返回参数
名称 |
类型 |
描述 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
result |
Object[] |
本页包含的数据,即会话列表 |
result
content |
String |
消息内容 |
role |
String |
对话角色BOT,机器人 USER,用户 |
files |
Object[] |
文档内容 |
faqs |
Object[] |
文本内容 |
createTime |
String |
创建时间 |
files
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
知识 id |
name |
String |
知识名称 |
fileKey |
String |
知识文件Key |
faqs
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
知识 id |
name |
String |
知识名称 |
返回示例
{
"result": [
{
"content": "呼叫中心",
"createTime": "2024-05-30T07:00:05.577+00:00",
"role": "USER",
"files": null,
"faqs": null
},
{
"content": "抱歉,我暂时没有找到合适的答案,您可以尝试换种方式提问",
"createTime": "2024-05-30T07:00:06.751+00:00",
"role": "BOT",
"files": null,
"faqs": null
}
],
"pageNumber": 1,
"requestId": null,
"pageSize": 100,
"totalCount": 4
}
7.4. 更新会话
POST /aikb/update_conversation
请求参数
名称 |
类型 |
是否必需 |
描述 |
conversationId |
String |
true |
会话 id |
title |
String |
true |
会标标题,最大不能超过 10个字符 |
示例
请求URL
https://api-bj.clink.cn/aikb/update_conversation
&<公共请求参数>
RequestBody请求参数
{
"conversationId": "a1f3294570a64dc48d153186379cc9ef",
"title": "我是新标题"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
requestId |
String |
唯一标识 |
返回示例
{
"requestId": "1dd8643f-505a-41a8-b943-e0246d3cbcba"
}
7.5. 删除会话
POST /aikb/delete_conversation
请求参数
名称 |
类型 |
是否必需 |
描述 |
conversationId |
String |
true |
会话 id |
示例
请求URL
https://api-bj.clink.cn/aikb/delete_conversation
&<公共请求参数>
RequestBody请求参数
{
"conversationId": "a1f3294570a64dc48d153186379cc9ef"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
requestId |
String |
唯一标识 |
返回示例
{
"requestId": "1dd8643f-505a-41a8-b943-e0246d3cbcba"
}
8. 知识搜索接口
8.1. 问题搜索
POST /aikb/search_knowledge_on_open
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
userId |
Integer |
false |
提问用户 Id |
keyword |
String |
true |
搜索关键词 |
orderField |
String |
false |
排序字段;createTime:创建时间,searchCount:热度,likeCount:点赞,updateTime,修改时间,不传按照默认排序规则 |
knowledgeType |
String |
false |
指定知识类型 可选值 FAQ, FILE |
repositoryIds |
Integer[] |
false |
指定知识库IDs |
directoryIds |
Integer[] |
false |
指定目录IDs |
offset |
Integer |
true |
偏移量,默认值从0开始 |
limit |
Integer |
true |
查询记录条数 |
示例
请求URL
https://api-bj.clink.cn/search_knowledge_on_open
&<公共请求参数>
RequestBody请求参数
{
"userId":12345,
"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 |
否 |
搜索次数,表示此消息被搜索到的次数 |
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,
"answers": null,
"content": null,
"introduction": "",
"directoryNames": null,
"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": null,
"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": null,
"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": null,
"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
}
9. 媒体预览下载接口
9.1. File文件预览或下载
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"
}
9.2. Faq文件预览或下载
GET /aikb/describe_faq_media_url
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
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"
}
10. 机器人知识库管理接口
10.1. 获取标准问分页列表
GET /kb/page_standard_question
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
updateTime |
String |
false |
更新时间,不包含当前时间点;格式:yyyy/MM/dd HH:mm:ss |
offset |
String |
true |
偏移量,默认值为 0,最大范围 10000 |
limit |
String |
true |
查询记录条数,默认值为 10,最大范围 100 |
示例
请求URL
https://api-bj.clink.cn/page_standard_question?botId=123456
&updateTime=1999/01/01%2008:00:00
&offset=0
&limit=10
&<公共请求参数>
返回参数
名称 |
类型 |
描述 |
pageNumber |
Integer |
当前所在页 |
pageSize |
Integer |
本页容量 |
totalCount |
Integer |
数据库中总记录条数 |
standardQuestions |
Object[] |
本页包含的数据,即标准问列表 |
standardQuestions
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
标准问ID |
title |
String |
标准问标题 |
sqIsDelete |
Boolean |
标准问是否是删除;true:删除,false:未删除 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"pageNumber": 1,
"pageSize": 20,
"totalCount": 1,
"standardQuestions": [
{
"id": 11017,
"title": "标准问标题",
"sqIsDelete": true
}
]
}
10.2. 获取标准问列表
GET /kb/list_standard_question
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
标准问ID |
title |
String |
标准问标题 |
createTime |
String |
创建时间 |
updateTime |
String |
更新时间 |
status |
Integer |
状态;0:已训练,1:未训练 |
corpusCount |
Integer |
语料个数 |
categoryId |
Integer |
分类ID;-1:暂无分类,当前知识会在暂无分类类别下 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"standardQuestions": [
{
"id": 11017,
"title": "标准问标题",
"createTime":"2021-07-29 15:26:04",
"updateTime": "2021-07-29 15:26:04",
"status": 0,
"corpusCount": 2,
"categoryId": -1
}
]
}
10.3. 新增标准问
POST /kb/create_standard_question
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
title |
String |
true |
标准问问题 |
categoryId |
Integer |
false |
分类ID |
示例
请求URL
https://api-bj.clink.cn/kb/create_standard_question
&<公共请求参数>
RequestBody请求参数
{
"botId":"1",
"title":"标题",
"categoryId":-1
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
标准问ID |
title |
String |
标准问问题 |
status |
Integer |
状态 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"standardQuestion":{
"id": 22,
"title":"1",
"status":0
}
}
10.4. 修改标准问
POST /kb/update_standard_question
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
标准问ID |
botId |
String |
true |
机器人ID |
title |
String |
true |
标准问问题 |
categoryId |
Integer |
false |
分类ID |
示例
请求URL
https://api-bj.clink.cn/kb/update_standard_question
&<公共请求参数>
RequestBody请求参数
{
"id": 123456,
"botId":"1",
"title":"标题",
"categoryId":-1
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
标准问ID |
title |
String |
标准问问题 |
status |
Integer |
状态 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"standardQuestion":{
"id": 22,
"title":"1",
"status":0
}
}
10.5. 删除标准问
POST /kb/delete_standard_question
请求参数
名称 |
类型 |
是否必需 |
描述 |
ids |
Integer[] |
true |
标准问ID数组 |
botId |
String |
true |
机器人ID |
示例
请求URL
https://api-bj.clink.cn/kb/delete_standard_question
&<公共请求参数>
RequestBody请求参数
{
"ids": [12,23],
"botId":"1"
}
返回参数
名称 |
类型 |
描述 |
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.6. 获取答案列表
GET /kb/list_answer
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
sqId |
Integer |
true |
标准问ID |
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
答案ID |
sqId |
Integer |
标准问ID |
answer |
String |
答案 |
startTime |
String |
生效开始时间;生效开始、结束时间为null,代表永久 |
endTime |
String |
生效结束时间;生效开始、结束时间为null,代表永久 |
periodType |
Integer |
生效时间日期类型; 0:无,1:每天 |
relatedQuestionList |
Object[] |
相关问列表 relatedQuestion 相关字段描述 |
relatedQuestion 相关字段描述
名称 |
类型 |
描述 |
relatedQuestionTitle |
String |
相关问标题 |
relatedQuestionId |
Integer |
相关问ID |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"answers": [
{
"id": 111,
"sqId": 654321,
"answer": "文本",
"startTime": null,
"endTime": null,
"periodType": 0,
"relatedQuestionList": [
{
"relatedQuestionId": 1,
"relatedQuestionTitle": "测试图片"
},
{
"relatedQuestionId": 2,
"relatedQuestionTitle": "验证导出标准问"
}
]
},
{
"id": 112,
"sqId": 654321,
"answer": "[{\"type\":\"text\",\"subType\":\"text\",\"value\":\"随风倒十分\",\"data\":[]},{\"type\":\"url\",\"subType\":\"image\",\"value\":\"/adm//ml/837d6acb29944a4bb9d68de9d0b25bd2/df0b1e440ebf4054b969004c6f68fc64UftyXrqhHD/image%281%29.png\",\"data\":[]}]",
"startTime": "2022-07-21 00:00:00",
"endTime": "2022-08-16 00:00:00",
"periodType": 0,
"relatedQuestionList": [
{
"relatedQuestionId": 3,
"relatedQuestionTitle": "美丽的图片5"
}
]
},
{
"id": 113,
"sqId": 654321,
"answer": "<p>服务 <img src=\"837d6acb29944a4bb9d68de9d0b25bd2|313cce3f94eb284db4f68fd5e2a57d2eNEWtsKQijl|%E5%90%B4.jpeg\"></p>",
"startTime": "2022-07-25 00:00:00",
"endTime": "2022-07-25 23:59:00",
"periodType": 1,
"relatedQuestionList": [
{
"relatedQuestionId": 4,
"relatedQuestionTitle": "美丽的图片4"
}
]
},
{
"id": 114,
"sqId": 654321,
"answer": "[{\"type\":\"url\",\"subType\":\"video\",\"value\":\"837d6acb29944a4bb9d68de9d0b25bd2|5610fbc7b18546484226c39a6c420b8bmRrfIqAHfx|WeChat_%E4%BD%A0%E6%98%AF%E7%8C%AA.mp4\",\"data\":[{\"name\":\"WeChat_你是猪.mp4\"}]},{\"type\":\"url\",\"subType\":\"docs\",\"value\":\"837d6acb29944a4bb9d68de9d0b25bd2|fdf30ac69155da5d2856251d36df5111DKxpBcPgip|360%E5%84%BF%E7%AB%A5%E6%89%8B%E8%A1%A8.docx\",\"data\":[{\"name\":\"360儿童手表.docx\"}]},{\"type\":\"url\",\"subType\":\"docs\",\"value\":\"837d6acb29944a4bb9d68de9d0b25bd2|861a656fc73824eb1ca543d42b5d97a2DSqWGWisiH|%E4%B8%8D%E5%90%8C%E6%A0%BC%E5%BC%8FAPI%E8%BF%94%E5%9B%9E-+response%E9%AB%98%E4%BA%AE.pdf\",\"data\":[{\"name\":\"不同格式API返回- response高亮.pdf\"}]}]",
"startTime": null,
"endTime": null,
"periodType": 0,
"relatedQuestionList": [
{
"relatedQuestionId": 5,
"relatedQuestionTitle": "美丽的图片3"
}
]
}
]
}
10.7. 新增答案
POST /kb/create_answer
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
sqId |
Integer |
true |
标准问ID |
answer |
String |
true |
答案内容 |
startTime |
String |
false |
开始时间; |
endTime |
String |
false |
结束时间; |
periodType |
Integer |
false |
日期类型;0:无,1:每天 |
relatedSqIdList |
String[] |
false |
关联相关问ID集合 |
示例
请求URL
https://api-bj.clink.cn/kb/create_answer
&<公共请求参数>
RequestBody请求参数
{
"botId": "23826232",
"answer": "哈哈哈哈哈1",
"startTime": "2022-06-16 00:00:00",
"endTime": "2022-06-16 23:59:59",
"sqId": 166955,
"relatedSqIdList": [
],
"periodType": 0
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
答案ID |
answer |
String |
答案内容 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"answer":{
"id": 22,
"answer":"啊啊啊"
}
}
10.8. 修改答案
POST /kb/update_answer
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
答案ID |
botId |
String |
true |
机器人ID |
sqId |
Integer |
true |
标准问ID |
answer |
String |
true |
答案内容 |
startTime |
String |
false |
开始时间 |
endTime |
String |
false |
结束时间 |
periodType |
Integer |
false |
日期类型; 0:无,1:每天 |
relatedSqIdList |
String[] |
false |
关联相关问ID集合 |
示例
请求URL
https://api-bj.clink.cn/kb/update_answer
&<公共请求参数>
RequestBody请求参数
{
"id": 12323,
"botId": "23826232",
"answer": "哈哈哈哈哈1",
"startTime": "2022-06-16 00:00:00",
"endTime": "2022-06-16 23:59:59",
"sqId": 166955,
"relatedSqIdList": [
],
"periodType": 1
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.9. 删除答案
POST /kb/delete_answer
请求参数
名称 |
类型 |
是否必需 |
描述 |
ids |
Integer[] |
true |
答案ID数组 |
botId |
String |
true |
机器人ID |
示例
请求URL
https://api-bj.clink.cn/kb/delete_answer
&<公共请求参数>
RequestBody请求参数
{
"ids": [12,23],
"botId":"12"
}
返回参数
名称 |
类型 |
描述 |
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.10. 获取语料列表
GET /kb/list_corpus
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
sqId |
Integer |
true |
标准问ID |
keyword |
String |
false |
关键词 |
offset |
Integer |
true |
偏移量,默认值从0开始 |
limit |
Integer |
true |
查询记录条数 |
示例
请求URL
https://api-bj.clink.cn/kb/list_corpus
?botId=123456
&sqId=654321
&keyword=abc
&offset=0
&limit=1000
&<公共请求参数>
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
语料ID |
sqId |
Integer |
标准问ID |
corpusName |
String |
语料名称 |
createTime |
String |
创建时间 |
updateTime |
String |
更新时间 |
status |
Integer |
状态;0:已训练,1:未训练 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"corpora": [
{
"id": 222,
"sqId": 654321,
"corpusName": "语料222",
"createTime": "2022-06-16 14:27:16",
"updateTime": "2022-06-16 14:27:16",
"status": 0
}
]
}
10.11. 新增语料
POST /kb/create_corpus
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
records |
Object[] |
true |
语料记录集合 record 相关字段描述 |
record 相关字段描述
名称 |
类型 |
是否必需 |
描述 |
sqId |
Integer |
true |
标准问ID |
corpusList |
Object[] |
true |
语料集合 corpus 相关字段描述 |
corpus 相关字段描述
名称 |
类型 |
是否必需 |
描述 |
corpusName |
String |
true |
语料名 |
示例
请求URL
https://api-bj.clink.cn/kb/create_corpus
&<公共请求参数>
RequestBody请求参数
{
"botId": "23423",
"records": [
{
"sqId": 166956,
"corpusList": [
{
"corpusName": "werew"
},
{
"corpusName": "rewerw"
}
]
},
{
"sqId": 166955,
"corpusList": [
{
"corpusName": "eee"
},
{
"corpusName": "www"
}
]
}
]
}
返回参数
名称 |
类型 |
描述 |
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.12. 修改语料
POST /kb/update_corpus
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
sqId |
Integer |
true |
标准问ID |
sourceCorpusName |
String |
true |
原始语料名称 |
targetCorpusName |
String |
true |
要修改语料名称 |
示例
请求URL
https://api-bj.clink.cn/kb/update_corpus
&<公共请求参数>
RequestBody请求参数
{
"botId": "23423",
"sqId": 166956,
"sourceCorpusName": "原始语料名",
"targetCorpusName": "目标语料名"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.13. 删除语料
POST /kb/delete_corpus
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
sqId |
String |
true |
标准问ID |
corpusNames |
String[] |
true |
语料名数组 |
示例
请求URL
https://api-bj.clink.cn/kb/delete_corpus
&<公共请求参数>
RequestBody请求参数
{
"botId": "23423",
"sqId": 23423,
"corpusNames": [
"哈哈",
"呵呵"
]
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.14. 新增分类
POST /kb/create_category
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
botId |
String |
true |
机器人ID |
parentId |
Integer |
true |
分类ID,一级分类为0 |
name |
String |
true |
分类名称 |
示例
请求URL
https://api-bj.clink.cn/kb/create_category
&<公共请求参数>
RequestBody请求参数
{
"botId": "23826232",
"parentId": 0,
"name": "分类目录名称"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
分类ID |
level |
Integer |
等级;分类级别(即目录层级),从1开始 |
name |
String |
分类名称 |
parentId |
Integer |
父类ID;1级分类,父类ID为0 |
path |
Integer[] |
路径;从1级分类到当前分类的分类ID数组 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"category":{
"id": 11017,
"level": 3,
"name":"分类名称",
"parentId": 11016,
"path": [
11013,
11016,
11017
]
}
}
10.15. 修改分类
POST /kb/update_category
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
分类ID |
botId |
String |
true |
机器人ID |
name |
String |
true |
分类名称 |
示例
请求URL
https://api-bj.clink.cn/kb/update_category
&<公共请求参数>
RequestBody请求参数
{
"id": 11017,
"botId": "23826232",
"name": "分类名称修改"
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
id |
Integer |
分类ID |
level |
Integer |
等级;分类级别(即目录层级),从1开始 |
name |
String |
分类名称 |
parentId |
Integer |
父类ID;1级分类,父类ID为0 |
path |
Integer[] |
路径;从1级分类到当前分类的分类ID数组 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"category":{
"id": 11017,
"level": 3,
"name":"分类名称修改",
"parentId": 11016,
"path": [
11013,
11016,
11017
]
}
}
10.16. 删除分类
POST /kb/delete_category
请求参数
名称 |
类型 |
是否必需 |
描述 |
id |
Integer |
true |
分类ID |
botId |
String |
true |
机器人ID |
示例
请求URL
https://api-bj.clink.cn/kb/delete_category
&<公共请求参数>
RequestBody请求参数
{
"id": 22,
"botId":"12"
}
返回参数
名称 |
类型 |
描述 |
result |
String |
结果描述 |
返回示例
{
"requestId":"842ab2a6-3732-4c03-8ab7-c7f83180fb0c",
"result": "OK"
}
10.17. 获取文件地址
GET /kb/media_url
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
fileKey |
String |
true |
资源文件的KEY |
fileName |
String |
false |
文件名称 |
isDownload |
Boolean |
false |
是否下载;true:下载,false:预览,默认预览 |
示例
请求URL
https://api-bj.clink.cn/kb/media_url
?fileKey=49985789e4724a5b94176f0314e2c545|26d35e36e98d966cc824517758ec7d2dvqTWhyWMHH微信图片_20210903140114.jpg
&<公共请求参数>
返回参数
名称 | 类型 | 描述 |
---|---|---|
mediaUrl |
String |
资源文件链接地址 |
返回示例
{
"requestId": "7c1bac0a-7851-42a3-93e9-01da7f0829aa",
"mediaUrl": "https://host/49985789e4724a5b94176f0314e2c545%7C26d35e36e98d966cc824517758ec7d2dvqTWhyWMHH%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20210903140114.jpg?Expires=1658901074&OSSAccessKeyId=LTAI5tDVoeXsQuGr1kwfBKF8&Signature=QBIzIBnJVGYD%2BkyS%2F1fjSVpixXI%3D&response-content-disposition=inline%3B%20filename%3D49985789e4724a5b94176f0314e2c545%7C26d35e36e98d966cc824517758ec7d2dvqTWhyWMHH%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20210903140114.jpg"
}
11. 文件库管理接口
11.1. 文件库分页列表接口
POST /kb/files_list
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
kbId |
Integer |
true |
知识库ID |
directoryId |
Integer |
false |
目录ID |
title |
String |
false |
文件名 |
offset |
Integer |
false |
偏移量,默认值为 0,最大范围 10000 |
limit |
Integer |
false |
查询记录条数,默认值为 10,最大范围 100 |
返回参数
名称 |
类型 |
描述 |
requestId |
String |
唯一标识 |
totalCount |
Integer |
总条数 |
pageNumber |
Integer |
当前页 |
pageSize |
Integer |
当前页条数 |
data |
Object |
当前页中存放的记录 |
data
名称 | 类型 | 描述 |
---|---|---|
id |
String |
主键id |
createTime |
long |
新增时间 |
updateTime |
long |
修改时间 |
enterpriseId |
String |
企业id |
title |
String |
标题 |
fileSize |
String |
文件大小(K) |
fileType |
String |
文件类型 |
filePath |
String |
文件路径 |
content |
Array |
搜索出的文档片段 |
directoryId |
Integer |
目录ID |
kbId |
Integer |
知识库ID |
kbType |
Integer |
所属知识库类型,冗余kbId对应库的类型 |
createUser |
String |
创建人 |
updateUser |
String |
更新人 |
accountLoginName |
String |
平台登录名 |
topStatus |
Integer |
0是非置顶 ,1是置顶 默认是0 |
likeCount |
Integer |
文件点赞数量 |
dislikeCount |
Integer |
文件点踩数量 |
status |
Integer |
0 已点赞 1 已点踩 null 未被点击 |
heat |
Integer |
文件热点数量 |
description |
String |
文件说明 |
返回示例
{
"pageNumber": 1,
"pageSize": 10,
"data": [
{
"id": "ilXbooYBYmvWisIQfUg-",
"createTime": 1677769538,
"updateTime": null,
"enterpriseId": "8001294",
"title": "备用2).png",
"fileSize": 91419,
"fileType": "png",
"filePath": "file/openapi/attachment/8001294/1677769537909.png",
"content": "",
"contentList": null,
"directoryId": 5341,
"kbId": 1193,
"kbType": 2,
"createUser": null,
"updateUser": null,
"accountLoginName": null,
"topStatus": 0,
"likeCount": null,
"dislikeCount": null,
"status": null,
"heat": null,
"description": null
}
],
"totalCount": 1,
"totalPageCount": 1,
"requestId": "a4ac5697-ee02-401a-9ec5-8cb491bcb549"
}
11.2. 文件库新增接口
POST /kb/files
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
kbId |
Integer |
true |
知识库ID |
enterpriseId |
String |
true |
企业ID |
directoryId |
Integer |
true |
目录ID |
file |
File |
true |
文件 |
示例
请求URL
https://api-bj.clink.cn/kb/files
?<公共请求参数>
RequestBody请求参数
{
"kbId":1,
"enterpriseId":"8000001",
"directoryId":1,
"file":PK
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
requestId |
String |
唯一标识 |
result |
Object |
返回结果 |
返回示例
{
"result": "b494fe6e576a4e09497534fdf2989c2d",
"requestId": "1dd8643f-505a-41a8-b943-e0246d3cbcba"
}
11.3. 文件库修改接口
POST /kb/files_update
请求参数
名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
Integer |
true |
文件ID |
filePath |
String |
true |
旧文件路径 |
description |
String |
false |
描述 |
file |
File |
true |
文件 |
示例
请求URL
https://api-bj.clink.cn/kb/files_update
&<公共请求参数>
RequestBody请求参数
{
"id":1,
"filePath":"file/picture/10101001.png",
"description":"描述",
"file": PK
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
requestId |
String |
唯一标识 |
result |
Object |
返回结果 |
返回示例
{
"result": "b494fe6e576a4e09497534fdf2989c2d",
"requestId": "1dd8643f-505a-41a8-b943-e0246d3cbcba"
}
11.4. 文件记录批量删除接口
POST /kb/files_delete
请求参数
名称 |
类型 |
是否必需 |
描述 |
ids |
String[] |
true |
文件ID数组 |
filePaths |
String[] |
true |
文件路径数组 |
示例
请求URL
https://api-bj.clink.cn/kb/files_delete
&<公共请求参数>
RequestBody请求参数
{
"ids": [
"iVUmoYYBYmvWisIQ_Ugg"
],
"filePaths": [
"file/22211221.zip"
]
}
返回参数
名称 | 类型 | 描述 |
---|---|---|
requestId |
String |
唯一标识 |
返回示例
{
"requestId": "1dd8643f-505a-41a8-b943-e0246d3cbcba"
}
11.5. 动态获取文件附件接口
POST /kb/files_attachment
请求参数
名称 |
类型 |
是否必需 |
描述 |
filePath |
String |
true |
文件路径 |
fileName |
String |
true |
文件名 |
示例
请求URL
https://api-bj.clink.cn/kb/files_attachment
&<公共请求参数>
RequestBody请求参数
{
"filePath":"file/picture/10101001.png",
"fileName":"测试图片.png"
}
返回参数
名称 |
类型 |
描述 |
- |
文件流 |
- |
返回示例
PK