URI:请求URI,采用RestFul风格
请求参数:参数说明。
接口统一返回格式:
{ "msg": "ok", #接口响应提示:正常响应返回ok,异常时返回错误信息 "requestTime": "2020-10-10 13:55:21", #处理时间 "code": 200, #接口响应结果:正常响应返回0,异常时返回1或者其它约定的错误码 "data": { #返回的数据部分。 #数据部分 }, "requestId": "61fe353d5141459e8b77507887d92dae" #请求唯一ID }
URI:/article/list/{cateId}/{pageId}
请求参数:int pageId,请求第几页; int cateId,文章分类ID,见文章分类接口,默认为0即所有类文章。
接口示例:http://api.04007.cn/article/list/0/1
返回全站文章列表。result部分返回示例:
{ "msg": "ok", "requestTime": "2020-10-10 13:55:21", "code": 200, "data": { "article": [{ "id": 848, #文章ID "arCid": 1, #文章分类ID "arTitle": "Elasticsearch:Fatal error: Uncaught Error: Class Psr\\Log\\NullLogger", #文章标题 "arTags": "Elasticsearch,错误,Uncaught Error: Class Psr\\Log\\NullLogger,Psr\\Log\\NullLogger", #文章关键词 "arText": "在测试环境执行后台任务的时候碰到报错:Fatalerror:UncaughtError:Cla法...", #文章内容,已经html过滤和截取 "arView": 837, #文章浏览次数 "arComments": 1, #文章评论数 "arDatetime": "2020-07-01 17:39:19" #文章发表时间 }, ......] }, "requestId": "61fe353d5141459e8b77507887d92dae" }
URI:/article/{id}
请求参数:int id,文章ID;
接口示例:http://api.04007.cn/article/1
返回具体文章详情。result部分返回示例:
{ "msg": "ok", "requestTime": "2020-10-10 13:55:21", "code": 200, "data": { "article": { #未注释字段同上 "id": 1, "arCid": 5, "arTitle": "我与我修身齐家治国平天下的人生理想", "arTags": "修身,齐家,治国,平天下", "arText": "《大学》有云: 古之欲明明德于天下者,先治其国;欲治其国者,先始做吧!亡羊补牢为时不晚。", "arView": 9835, "arComments": 0, "arCate": { "id": 5, #文章分类ID "className": "Book", #文章分类名称 "classFname": "读书_程序手册_生活" #分类名称涉及内容详细 }, "arDatetime": "2015-03-30 10:02:12" } }, "requestId": "b438e6373e244a2a8b9b241563404277" }
URI:/category/list
请求参数:无需传参
接口示例:http://api.04007.cn/category/list
返回全站文章分类数据。result部分返回示例:
{ "msg": "ok", "requestTime": "2020-10-10 14:13:44", "code": 200, "data": { "category": [{ "id": 18, #分类ID "className": "Java_Spring", #分类名称 "classFname": "Java/Spring_MVC/Mybatis/Spring_Boot" #分类名称涉及内容详细 },....] }, "requestId": "5656b27f89a2463fa5d0bbd55ffc2960" }
URI:/comment/list/{pageId}
请求参数:int pageId 返回第几页数据。
接口示例:http://api.04007.cn/comment/list/1
分页返回评论列表。result部分返回示例:
{ "msg": "ok", "requestTime": "2020-10-10 14:13:44", "code": 200, "data": { "comment": [{ "id": 264, "comUid": "us20200724112955-542", #评论用户uid "comArid": 836, #评论对应文章ID "comText": "楼主解决这个问题了么", #评论详情 "comTime": 1595568556, #评论时间戳值 "comIp": "114.251.122.178" #评论用户IP地址 },.....] }, "requestId": "f3f531d698214131824eaf85aecf8a48" }