Forums 文档分类接口
JSON 格式
Name | Type | Read-only | Comment |
---|---|---|---|
id | integer | yes | 文档分类id,由系统自动分配 |
url | string | yes | 资源url |
category_id | integer | no | 该分类所属的文档分区 |
title | string | no | 文档分类名称 |
content | string | no | 文档分类描述 |
role_view | string | no | 文档分类查看权限, 可选值:all,logged_in,agent |
sort | integer | no | 文档分类前台显示顺序 |
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