在richcms的0.0.0_3和版本上,可以使用API调用栏目信息,调用前,请参考 《richcms的API调用系列一:基础和鉴权》 一文章,了解API鉴权的要求。
一、获取所有栏目
get /openapi/v1/category/
错误返回:
{
"code": 1,
"msg": "[API Token] 鉴权失败",
"time": 1730774106,
"body": {
"pager": {
"page": 0,
"count": 0,
"page_count": 0
},
"data": null
}
}
正确的返回:
{
"code": 0,
"msg": "success",
"time": 1730774138,
"body": {
"pager": {
"page": 0,
"count": 0,
"page_count": 0
},
"data": [
{
"cate_id": 1,
"cate_name": "知识库",
"cate_e_name": "docs",
"parent_id": 0,
"root_id": 0,
"dept": 0,
"order_int": 0,
"category_type": 2,
"redirect_url": "",
"state": 1,
"title": "RichCMS帮助文档",
"keywords": "richcms文档,richcms使用,richcms教程",
"description": "本页面提供RichCMS系统的所有帮助文档,教程等,会保持持续更新的状态。",
"updated": 1721985555,
"created": 1721810907,
"link": ""
},
...
]
}
}
二、所有发布栏目
get /openapi/v1/category/finally
正确的返回:
{
"code": 0,
"msg": "success",
"time": 1730774265,
"body": {
"pager": {
"page": 0,
"count": 0,
"page_count": 0
},
"data": [
{
"cate_id": 1,
"cate_name": "知识库",
"cate_e_name": "docs",
"parent_id": 0,
"root_id": 0,
"dept": 0,
"order_int": 0,
"category_type": 2,
"redirect_url": "",
"state": 1,
"title": "RichCMS帮助文档",
"keywords": "richcms文档,richcms使用,richcms教程",
"description": "本页面提供RichCMS系统的所有帮助文档,教程等,会保持持续更新的状态。",
"updated": 1721985555,
"created": 1721810907,
"link": ""
},
...
]
}
}
三、数据结构
cate_id 栏目ID
cate_name 栏目名称
cate_e_name 栏目英文或拼音名称
parent_id 父栏目ID
root_id 根栏目ID
dept 层级
order_int 排序值
category_type 栏目类型:1 频道页,2,发布页,3 跳转页
redirect_url 跳转栏目的地址
state 栏目状态:1正常,0关闭
title t
keywords k
description d
updated 更新时间
created 创建时间