知识库Agent Tool查询接口
获取文档链接
获取指定文档的内外部链接。
请求体
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| spaceId | int64 | 是 | 知识库空间 ID。 | 123456 |
| docId | int64 | 是 | 文档 ID。 | 987654 |
| expireDays | int32 | 否 | 外部预览链接有效天数,必须大于 0,且不能超过服务端配置上限。 | 7 |
返回参数
| 名称 | 类型 | 描述 | 示例值 |
|---|---|---|---|
| code | int32 | 业务响应码。200 表示成功;失败时为 RetCode 中定义的业务码。 | 200 |
| msg | string | 响应说明。成功通常为 ok;失败时为错误原因。 | ok |
| message | string | 兼容字段,部分异常场景可能返回错误说明。 | |
| data | object | 文档链接。 | |
| └docId | int64 | 文档 ID。 | 987654 |
| └docName | string | 文档名称。 | 退款规则 |
| └innerLink | string | 内部访问链接,适用于企业内部登录态访问。 | https://b.163.com/doc/inner |
| └outerLink | string | 外部分享链接,适用于开放给外部协作方访问。 | https://b.163.com/doc/share |
错误码
| 状态码 | 描述 |
|---|---|
| 400 | 请求参数错误。常见业务码:402 MISS_PARAM、403 ERR_PARAM。 |
| 401 | PERSONAL_API 鉴权失败。常见业务码:405 AUTH_FAILED。 |
| 404 | 资源不存在。常见业务码:404 NOT_FOUND。 |
| 500 | 服务内部异常。常见业务码:500 ERROR。 |
postEndpoint
/api/athena/agent/tool/getDocLinkcurl -X POST "https://b.163.com/api/athena/agent/tool/getDocLink" \ -H "Content-Type: application/json" \ -d '{ "spaceId": 123456, "docId": 987654 }'{
"code": 200,
"msg": "ok",
"message": "string",
"data": {
"docId": 987654,
"docName": "退款规则",
"innerLink": "https://b.163.com/doc/inner",
"outerLink": "https://b.163.com/doc/share"
}
}{
"code": 200,
"msg": "ok",
"message": "string"
}{
"code": 200,
"msg": "ok",
"message": "string"
}{
"code": 200,
"msg": "ok",
"message": "string"
}{
"code": 200,
"msg": "ok",
"message": "string"
}这篇文档有帮助吗?