Skip to content

创建知识库

该接口用于创建知识库。

Tip: 注意事项: user_access_token 访问,需要操作者是当前服务台的客服、管理员或所有者

请求

项目
HTTP URLhttps://open.feishu.cn/open-apis/helpdesk/v1/faqs
HTTP MethodPOST
接口频率限制特殊频控
支持的应用类型custom
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用helpdesk:all 更新服务台资源详情

请求头

名称类型必填描述
Authorizationstringuser_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring固定值:"application/json; charset=utf-8"

Tip: 服务台请求Header中还需添加“服务台token”参数:

Key: X-Lark-Helpdesk-Authorization

Value: base64(helpdesk_id:helpdesk_token),通过base64加密将helpdesk_id和helpdesk_token用':'连接而成的字符串。

了解更多:获取与使用服务台token

请求体

名称类型必填描述
faqfaq_update_info知识库详情
  └ category_idstring知识库分类ID
示例值:"6836004780707807251"
  └ questionstring问题
示例值:"问题"
  └ answerstring答案
示例值:"答案"
  └ answer_richtextstring富文本答案和答案必须有一个必填。Json Array格式,富文本结构请见了解更多: 富文本
注意: 以下示例值未转义,使用时请注意转义。
示例值:"[{\"content\":\"答案\",\"type\":\"text\"},{\"content\":\"这只是一个测试,医保问题\",\"type\":\"text\"}]"
  └ tagsstring\[\]相似问题
示例值:["问","题"]

请求体示例

json
{
    "faq": {
        "category_id": "6836004780707807251",
        "question": "问题",
        "answer": "答案",
        "answer_richtext": "[{\"content\":\"答案\",\"type\":\"text\"},{\"content\":\"这只是一个测试,医保问题\",\"type\":\"text\"}]",
        "tags": [
            "问",
            "题"
        ]
    }
}

响应

响应体

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--
  └ faqfaq知识库详情
    └ faq_idstring知识库ID
    └ idstring知识库旧版ID,请使用faq_id
    └ helpdesk_idstring服务台ID
    └ questionstring问题
    └ answerstring答案
    └ answer_richtextrichtext\[\]富文本答案
      └ contentstring内容
      └ typestring类型
    └ create_timeint创建时间
    └ update_timeint修改时间
    └ categoriescategory\[\]分类
      └ category_idstring知识库分类ID
      └ idstring知识库分类ID,(旧版,请使用category_id)
      └ namestring名称
      └ parent_idstring父知识库分类ID
      └ helpdesk_idstring服务台ID
      └ languagestring语言
    └ tagsstring\[\]相似问题列表
    └ expire_timeint失效时间
    └ update_userticket_user更新用户
      └ idstring用户ID
      └ avatar_urlstring用户头像url
      └ namestring用户名
      └ departmentstring所在部门名称
      └ citystring城市
      └ countrystring国家代号(CountryCode),参考:http://www.mamicode.com/info-detail-2186501.html
    └ create_userticket_user创建用户
      └ idstring用户ID
      └ avatar_urlstring用户头像url
      └ namestring用户名
      └ departmentstring所在部门名称
      └ citystring城市
      └ countrystring国家代号(CountryCode),参考:http://www.mamicode.com/info-detail-2186501.html

响应体示例

json
{
    "code": 0,
    "msg": "success",
    "data": {
        "faq": {
            "faq_id": "6936004780707807231",
            "id": "6936004780707807231",
            "helpdesk_id": "6936004780707807251",
            "question": "问题",
            "answer": "答案",
            "answer_richtext": [
                {
                    "content": "我的答案",
                    "type": "text"
                }
            ],
            "create_time": 1596379008,
            "update_time": 1596379008,
            "categories": [
                {
                    "category_id": "6948728206392295444",
                    "id": "6948728206392295444",
                    "name": "创建团队和邀请成员",
                    "parent_id": "0",
                    "helpdesk_id": "6939771743531696147",
                    "language": "zh_cn"
                }
            ],
            "tags": [
                "问",
                "题"
            ],
            "expire_time": 1596379008,
            "update_user": {
                "id": "ou_37019b7c830210acd88fdce886e25c71",
                "avatar_url": "https://xxxx",
                "name": "abc",
                "department": "用户部门名称(有权限才展示)",
                "city": "城市",
                "country": "国家"
            },
            "create_user": {
                "id": "ou_37019b7c830210acd88fdce886e25c71",
                "avatar_url": "https://xxxx",
                "name": "abc",
                "department": "用户部门名称(有权限才展示)",
                "city": "城市",
                "country": "国家"
            }
        }
    }
}

错误码

HTTP状态码错误码描述排查建议
400154000Bad request, please check your request body请求不合法,请检查参数
500155000Internal error内部错误,请联系我们

内容来源:飞书开放平台 · 自动爬取整理