# 知识节点评论接口

# 创建评论

请求URL

POST https://lxapi.lexiangla.com/cgi-bin/v1/kb/comments

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为评论创建人

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参data.relationships.target.data.id对应的知识节点或评论所属知识库需在授权团队范围内
图片上传 image_urls中的图片需先通过上传接口上传,并使用响应里的url字段;12004返回的是state,不适用于本接口
频率限制 3000次/分钟

请求参数

{
  "data": {
    "type": "comment",
    "attributes": {
      "content": "这是一条评论内容",
      "image_urls": [
        "https://lexiangla.com/assets/example.png"
      ]
    },
    "relationships": {
      "target": {
        "data": {
          "type": "entry",
          "id": "xx"
        }
      }
    }
  }
}

参数说明

参数 是否必须 说明
data.attributes.content 评论纯文本内容,contentimage_urls 至少需要提供一个
data.attributes.image_urls 评论图片URL列表,最多9张,contentimage_urls 至少需要提供一个;图片需先通过上传接口上传,再使用响应中的url字段
data.attributes.image_urls.* 图片URL地址,需为安全域名下的合法URL,最大2048个字符
data.relationships.target 评论目标对象
data.relationships.target.data.type 目标类型
entry:知识节点
data.relationships.target.data.id 目标ID,最大36个字符

响应

200 Ok 状态码

{
  "data": {
    "type": "comment",
    "id": "a1b2c3d4e5f6",
    "attributes": {
      "content": "这是一条评论内容",
      "image_urls": [
        "https://lexiangla.com/assets/example.png"
      ],
      "created_at": "2026-04-01 10:00:00",
      "updated_at": "2026-04-01 10:00:00"
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "staff",
          "id": "LX001"
        }
      }
    }
  },
  "included": [
    {
      "type": "staff",
      "id": "LX001",
      "attributes": {
        "name": "张三",
        "english_name": "zhangsan",
        "organization": "开发组"
      }
    }
  ]
}

参数说明

参数 说明
content 评论纯文本内容
image_urls 评论图片URL列表,无图片时为空数组
created_at 创建时间
updated_at 更新时间
relationships.owner 评论创建者,可根据 id 在 included 中查找

# 删除评论

请求URL

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/kb/comments/{comment_id}

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,需具备删除该评论的权限

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参{comment_id}所属评论对应的知识库需在授权团队范围内
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
comment_id 评论ID

响应

204 No Content

# 创建回复

请求URL

POST https://lxapi.lexiangla.com/cgi-bin/v1/kb/comments/{comment_id}/replies

请求头

参数 是否必须 说明
Content-Type 固定值:"application/json; charset=utf-8"
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,作为回复创建人

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参{comment_id}所属评论对应的知识库需在授权团队范围内
图片上传 image_urls中的图片需先通过上传接口上传,并使用响应里的url字段;12004返回的是state,不适用于本接口
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
comment_id 评论ID

请求参数

{
  "data": {
    "type": "comment",
    "attributes": {
      "content": "这是一条回复内容",
      "image_urls": [
        "https://lexiangla.com/assets/reply-image.png"
      ]
    }
  }
}

参数说明

参数 是否必须 说明
data.attributes.content 回复纯文本内容,contentimage_urls 至少需要提供一个
data.attributes.image_urls 回复图片URL列表,最多9张,contentimage_urls 至少需要提供一个;图片需先通过上传接口上传,再使用响应中的url字段
data.attributes.image_urls.* 图片URL地址,需为安全域名下的合法URL,最大2048个字符

响应

200 Ok 状态码

{
  "data": {
    "type": "comment",
    "id": "f6e5d4c3b2a1",
    "attributes": {
      "content": "这是一条回复内容",
      "image_urls": [
        "https://lexiangla.com/assets/reply-image.png"
      ],
      "created_at": "2026-04-01 11:00:00",
      "updated_at": "2026-04-01 11:00:00"
    },
    "relationships": {
      "owner": {
        "data": {
          "type": "staff",
          "id": "LX001"
        }
      }
    }
  },
  "included": [
    {
      "type": "staff",
      "id": "LX001",
      "attributes": {
        "name": "张三",
        "english_name": "zhangsan",
        "organization": "开发组"
      }
    }
  ]
}

参数说明

参数 说明
content 回复纯文本内容
image_urls 回复图片URL列表,无图片时为空数组
created_at 创建时间
updated_at 更新时间
relationships.owner 回复创建者,可根据 id 在 included 中查找

# 删除回复

请求URL

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/kb/replies/{reply_id}

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"
x-staff-id 成员帐号,需具备删除该回复的权限

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参{reply_id}所属回复对应的知识库需在授权团队范围内
频率限制 3000次/分钟

URL 参数说明

参数 是否必须 说明
reply_id 回复ID

响应

204 No Content

# 获取评论列表

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/comments

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参target_id所在知识库需在授权团队范围内
频率限制 3000次/分钟
列表排序 默认按创建时间created_at倒序,可通过sort_by参数设置

参数说明

参数 是否必须 说明
target_type 评论目标类型
entry:知识节点
target_id 评论目标ID,最大36个字符
limit 限制个数,1~100 以内的整数
page_token 分页游标,根据上一页返回的 next_page_token 传入
sort_by 排序方式
created_at:按创建时间升序;-created_at:按创建时间倒序;updated_at:按更新时间升序;-updated_at:按更新时间倒序

响应

200 Ok 状态码

{
  "data": [
    {
      "type": "comment",
      "id": "a1b2c3d4e5f6",
      "attributes": {
        "content": "这是一条评论内容",
        "image_urls": [
          "https://lexiangla.com/assets/example.png"
        ],
        "created_at": "2026-04-01 10:00:00",
        "updated_at": "2026-04-01 10:00:00"
      },
      "relationships": {
        "owner": {
          "data": {
            "type": "staff",
            "id": "LX001"
          }
        }
      }
    }
  ],
  "included": [
    {
      "type": "staff",
      "id": "LX001",
      "attributes": {
        "name": "张三",
        "english_name": "zhangsan",
        "organization": "开发组"
      }
    }
  ],
  "meta": {
    "next_page_token": "WyIyMDI2LTA0LTAxVDEwOjAwOjAwKzA4OjAwIiwxMDFd",
    "prev_page_token": "",
    "has_more": true
  }
}

参数说明

参数 说明
content 评论纯文本内容
image_urls 评论图片URL列表,无图片时为空数组
created_at 创建时间
updated_at 更新时间
relationships.owner 评论创建者,可根据 id 在 included 中查找
meta.next_page_token 下一页游标,为空时表示没有下一页
meta.prev_page_token 上一页游标,为空时表示没有上一页
meta.has_more 是否有更多数据

# 获取回复列表

请求URL

GET https://lxapi.lexiangla.com/cgi-bin/v1/kb/comments/{comment_id}/replies

请求头

参数 是否必须 说明
Authorization 接口调用凭证 access_token
值格式:"Bearer access_token"
示例值:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS"

其他说明

事项 说明
权限要求 知识库管理
授权范围 AppKey绑定团队时,入参{comment_id}所属评论对应的知识库需在授权团队范围内
频率限制 3000次/分钟
列表排序 默认按创建时间created_at倒序,可通过sort_by参数设置

URL 参数说明

参数 是否必须 说明
comment_id 评论ID

参数说明

参数 是否必须 说明
limit 限制个数,1~100 以内的整数
page_token 分页游标,根据上一页返回的 next_page_token 传入
sort_by 排序方式
created_at:按创建时间升序;-created_at:按创建时间倒序;updated_at:按更新时间升序;-updated_at:按更新时间倒序

响应

200 Ok 状态码

{
  "data": [
    {
      "type": "comment",
      "id": "f6e5d4c3b2a1",
      "attributes": {
        "content": "这是一条回复内容",
        "image_urls": [],
        "created_at": "2026-04-01 11:00:00",
        "updated_at": "2026-04-01 11:00:00"
      },
      "relationships": {
        "owner": {
          "data": {
            "type": "staff",
            "id": "LX002"
          }
        }
      }
    }
  ],
  "included": [
    {
      "type": "staff",
      "id": "LX002",
      "attributes": {
        "name": "李四",
        "english_name": "lisi",
        "organization": "产品组"
      }
    }
  ],
  "meta": {
    "next_page_token": "WyIyMDI2LTA0LTAxVDExOjAAOjAwKzA4OjAwIiwyMDFd",
    "prev_page_token": "",
    "has_more": false
  }
}

参数说明

参数 说明
content 回复纯文本内容
image_urls 回复图片URL列表,无图片时为空数组
created_at 创建时间
updated_at 更新时间
relationships.owner 回复创建者,可根据 id 在 included 中查找
meta.next_page_token 下一页游标,为空时表示没有下一页
meta.prev_page_token 上一页游标,为空时表示没有上一页
meta.has_more 是否有更多数据