开放API接口
微微CMS默认没有开启API接口。如需使用此能力,需要使用修改配置文件将`open_api`的值更改为1.
此功能仅在5.7功能上新增。适用于小程序等环境。
注意:所有的api的base都在 /api 之下
文章分类api
访问路径 | 返回值 | 说明 |
---|---|---|
/categories | 获取分类列表 | |
/categories/{url:string} | 获取分类及分类下的文章 | |
/categories/{id:uint} | 根据分类的ID获取分类及分类下的文章 | |
/categories/:url/:page | 根据分类URL获取分类几文章带分页 |
文章api
访问路径 | 返回值 | 说明 |
---|---|---|
articles | 文章列表 | |
/articles/page/:page | 文章列表带分页 | |
/articles/:id | 文章详情 | |
/articles/top | 全局置顶文章 | |
/articles/top/:num | 全局置顶文章带取的条数 | |
/articles/recommend | 全局推荐 | |
/articles/recommend/:num | 全局推荐带取的条数 | |
/articles/rand | 随机获取文章(sqlite数据库不支持) | |
/articles/rand/:num | 随机获取文章带条数(sqlite数据库不支持) | |
/articles/new | 最新文章 | |
/articles/new/:num | 最新文章带条数 | |
/articles/hot | 热门文章 | |
/articles/hot/:num | 热门文章带条数 |
文章评论
访问路径 | 返回值 | 说明 |
---|---|---|
/articles/comments/:article_id | 获取文章评论 | |
/articles/comments/zan/:article_id | 评论点赞 | |
/articles/zan/:article_id | 文章点赞 | |
/articles/:article_id | 文章评论(POST) | |
/message | 系统留言(POST) |
内联文章
访问路径 | 返回值 | 说明 |
---|---|---|
/articles/intop/:cate_id | 指定分类下的置顶文章 | |
/articles/intop/:cate_id/:num | 指定分类下的置顶文章带获取条数 | |
/articles/inrecommend/:cate_id | 指定分类下的推荐文章 | |
/articles/inrecommend/:cate_id/:num | 指定分类下的推荐文章带获取条数 | |
/articles/inrand/:cate_id | 指定分类下的随机文章 | |
/articles/inrand/:cate_id/:num | 指定分类下的随机文章带获取条数 | |
/articles/innew/:cate_id | 指定分类下的最新文章 | |
/articles/innew/:cate_id/:num | 指定分类下的最新文章带获取条数 | |
/articles/inhot/:cate_id | 指定分类下的热门文章 | |
/articles/inhot/:cate_id/:num | 指定分类下的热门文章带获取条数 |
文章分页
访问路径 | 返回值 | 说明 |
---|---|---|
/articles/pre/:article_id | 文章上一页 | |
/articles/next/:article_id | 文章下一页 | |
/articles/pre_cate/:cate_id/:article_id | 指定分类下指定文章的上一页 | |
/articles/next_cate/:cate_id/:article_id | 指定分类下指定文章的下一页 |
搜索
访问路径 | 返回值 | 说明 |
---|---|---|
/search/:keyword | 指定关键字搜索 | |
/search/:keyword/:page | 指定关键字搜索带分页 |
广告
访问路径 | 返回值 | 说明 |
---|---|---|
/adcates | 所有广告分类 | |
/adcates/{label:string} | 根据label获取广告分类下的广告 | |
/adcates/{id:uint} | 根据id获取广告分类下的广告 | |
/ad/{label:string} | 根据label获取广告 | |
/ad/{id:int} | 根据id获取广告 |
标签
访问路径 | 返回值 | 说明 |
---|---|---|
/tags | tags列表 | |
/tags/page | tags列表带分页 | |
/tags/page/:page | tags列表带分页 | |
/tags/:tag_name | 指定tags下的文章 | |
/tags/:tag_name/:page | 指定tags下的文章带分页 |
专题
访问路径 | 返回值 | 说明 |
---|---|---|
/topics | topics列表 | |
/topics/page | topics列表带分页 | |
/topics/page/:page | topics列表带分页 | |
/topics/:topic_name | 指定topic下的文章 | |
/topics/:topic_name/:page | 指定topic下的文章带分页 |
单页
访问路径 | 返回值 | 说明 |
---|---|---|
/pages | 单页列表 | |
/pages/:url | 指定单页 |
日期归档数据
访问路径 | 返回值 | 说明 |
---|---|---|
/archives | 日期归档列表 | |
/archives/:date | 指定日期的归档文章 | |
/archives/:date/page/:page | 指定日期的归档文章带分页 |