Forums 文档分类接口

JSON 格式

NameTypeRead-onlyComment
idintegeryes文档分类id,由系统自动分配
urlstringyes资源url
category_idintegerno该分类所属的文档分区
titlestringno文档分类名称
contentstringno文档分类描述
role_viewstringno文档分类查看权限, 可选值:all,logged_in,agent
sortintegerno文档分类前台显示顺序

JSON 示例

{
  "id": 421,
  "url": "https://support.kf5.com/apiv2/forums/421.json",
  "category_id": 82,
  "title": "建议提交",
  "content": "建议与提交",
  "role_view": "all",
  "sort": 0
}

文档分类列表

GET /apiv2/forums.json GET /apiv2/categories/{id}/forums.json
调用权限

all users

注意:如果某文档分类的查看权限为客服,则普通用户无法查看该文档分类及其下所有的文档

curl 示例
curl https://{subdomain}.kf5.com/apiv2/forums.json \
  -v -u {email_address}:{password}
返回示例
Status: 200 OK

{
  "forums": [
    {
      "id":   421,
      "title": "建议提交",
      ...
    },
    {
      "id":   425,
      "title": "问题反馈",
      ...
    }
  ]
}

查看文档分类

GET /apiv2/forums/{id}.json
调用权限

all users

curl 示例
curl https://{subdomain}.kf5.com/apiv2/forums.json \
  -v -u {email_address}:{password}
返回示例
Status: 200 OK

{
  "forum": {
   	  "id":   421,
      "title": "建议提交",
      ...
   }
}

创建文档分类

POST /apiv2/forums.json
调用权限

admin

curl 示例
curl https://{subdomain}.kf5.com/apiv2/forums.json \
  -H "Content-Type: application/json" -d '{"forum": {"title": "this is forums title","content": "this is content","role_view": "all"}}' \
  -v -u {email_address}:{password} -X POST
返回示例
Status: 200 OK
Location: https://{subdomain}.kf5.com/apiv2/forums/{id}.json

{
  "forum": {
      "id":   1234,
      "title": "this is forums title",
      ...
   }
}

修改文档分类

PUT /apiv2/forums/{id}.json
调用权限

admin

curl 示例
curl https://{subdomain}.kf5.com/apiv2/forums/{id}.json \
  -H "Content-Type: application/json" -d '{"forum": {"title": "this is new title"}}' \
  -v -u {email_address}:{password} -X PUT
返回示例
Status: 200 OK

{
  "forum": {
      "id":   2014,
      "title": "this is new title",
      ...
   }
}

删除文档分类

DELETE /apiv2/forums/{id}.json
调用权限

admin

注意:调用该API资源会同时删除该文档分类下的所有文档
curl 示例
curl https://{subdomain}.kf5.com/apiv2/forums/{id}.json \
  -v -u {email_address}:{password} -X DELETE
返回示例
Status: 200 OK