Topics 社区话题接口

JSON 格式

NameTypeRead-onlyComment
idintegeryes社区话题id,由系统自动分配
urlstringyes资源url
titlestringno社区话题名称
descriptionstringno社区话题描述
sortintegerno社区话题前台显示顺序

JSON 示例

{
  "id": 421,
  "url": "https://support.kf5.com/apiv2/topics/10.json",
  "title": "提问帮助",
  "description": "这里可以了解其他用户的疑问和解答",
  "sort": 0
}

社区话题列表

GET /apiv2/topics.json
调用权限

all users

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

{
  "topics": [
    {
      "id":   421,
      "title": "提问帮助",
      ...
    },
    {
      "id":   429,
      "title": "产品讨论",
      ...
    }
  ]
}

查看社区话题

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

all users

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

{
  "topic": {
   	  "id":   421,
      "title": "提问帮助",
      ...
   }
}

创建社区话题

POST /apiv2/topics.json
调用权限

admin

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

{
  "topic": {
      "id":   1254,
      "title": "this is topic title",
      ...
   }
}

修改社区话题

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

admin

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

{
  "topic": {
      "id":   2219,
      "title": "this is new title",
      ...
   }
}

删除社区话题

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

admin

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