Categories 文档分区接口
JSON 格式
Name | Type | Read-only | Comment |
---|---|---|---|
id | integer | yes | 文档分区id,由系统自动分配 |
url | string | yes | 资源url |
title | string | no | 文档分区名称 |
content | string | no | 文档分区描述 |
display_limit | integer | no | 该分区在前台显示的每个分类的下的文档数量 |
sort | integer | no | 文档分区前台显示顺序 |
JSON 示例
{
"id": 104,
"url": " https://support.kf5.com/apiv2/categories/104.json",
"title": "流程指引",
"content": "这是是帮助分类",
"display_limit": 3,
"sort": 2
}
文档分区列表
GET /apiv2/categories.json
调用权限
all users
curl 示例
curl https://{subdomain}.kf5.com/apiv2/categories.json \
-v -u {email_address}:{password}
返回示例
Status: 200 OK
{
"categories": [
{
"id": 85,
"title": "帮助支持",
...
},
{
"id": 104,
"title": "流程指引",
...
}
]
}
查看文档分区
GET /apiv2/categories/{id}.json
调用权限
all users
curl 示例
curl https://{subdomain}.kf5.com/apiv2/categories.json \
-v -u {email_address}:{password}
返回示例
Status: 200 OK
{
"category": {
"id": 104,
"title": "流程指引",
...
}
}
创建文档分区
POST /apiv2/categories.json
调用权限
admin
curl 示例
curl https://{subdomain}.kf5.com/apiv2/categories.json \
-H "Content-Type: application/json" -d '{"category": {"title": "post category","content": "this is content"}}' \
-v -u {email_address}:{password} -X POST
返回示例
Status: 200 OK
Location: https://{subdomain}.kf5.com/apiv2/categories/{id}.json
{
"category": {
"id": 1234,
"title": "post category",
...
}
}
修改文档分区
PUT /apiv2/categories/{id}.json
调用权限
admin
curl 示例
curl https://{subdomain}.kf5.com/apiv2/categories/{id}.json \
-H "Content-Type: application/json" -d '{"category": {"content": "new content"}}' \
-v -u {email_address}:{password} -X PUT
返回示例
Status: 200 OK
{
"category": {
"id": 2014,
"title": "post category",
...
}
}
删除文档分区
DELETE /apiv2/categories/{id}.json
调用权限
admin
注意:调用该API资源会同时删除该文档分区下的所有分类及其下的所有文档
curl 示例
curl https://{subdomain}.kf5.com/apiv2/categories/{id}.json \
-v -u {email_address}:{password} -X DELETE
返回示例
Status: 200 OK