- 必须先读
- Ajax编程_V7.6大纲配套
- 数据可视化
- Vue基础
- Vue_大事件
- 黑马头条号
- 极客园_PC
- 极客园(黑马头条)_移动端
- 人资项目
- 小兔鲜电商
- 小程序基础
- 小程序项目
- layui_大事件
- 品优购电商后台
- 其他可用接口
获取-新闻列表
GET
/api/news
请求参数
无
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request GET 'http://ajax-api.itheima.net/api/news'
返回响应
🟢200成功
application/json
Body
message
string
响应消息
data
array [object {6}]
响应数据
id
integer
新闻id
title
string
新闻标题
source
string
新 闻来源
cmtcount
integer
新闻评论总数
img
string
新闻图片地址
例如: http://ajax-api.itheima.net/public/images/2.webp
time
string
新闻发布时间
示例
{
"message": "获取新闻列表成功",
"data": [
{
"id": 1,
"title": "5G商用在即,三大运营商营收持续下降",
"source": "新京报经济新闻",
"cmtcount": 58,
"img": "/images/0.webp",
"time": "2019-10-28 11:50:28"
},
{
"id": 2,
"title": "国际媒体头条速览:特朗普宣布杀死巴格达迪时,有人想起了奥巴马",
"source": "环视全球",
"cmtcount": 56,
"img": "/images/1.webp",
"time": "2019-10-27 13:50:55"
},
{
"id": 3,
"title": "华为5G随行WiFi发布,5G布局全面领先苹果、三星",
"source": "驱动中国网络传媒",
"cmtcount": 32,
"img": "/images/2.webp",
"time": "2019-10-26 16:51:30"
},
{
"id": 4,
"title": "沈义人:首批5G手机最好选集成SoC和双模SA+NSA",
"source": "手机中国",
"cmtcount": 18,
"img": "/images/3.webp",
"time": "2019-10-25 18:03:21"
},
{
"id": 5,
"title": "为什么说中美阶段性协议再近一步,读懂周末的这些关键信息",
"source": "澎湃新闻",
"cmtcount": 131,
"img": "/images/4.webp",
"time": "2019-10-24 09:08:34"
},
{
"id": 6,
"title": "阿根廷大选结果揭晓:反对派候选人费尔南德斯当选下任总统",
"source": "海外网",
"cmtcount": 99,
"img": "/images/5.webp",
"time": "2019-10-23 17:41:15"
},
{
"id": 7,
"title": "赵薇谈演员整容:不是一件坏事情,但劝大家别整太像",
"source": "腾讯视频Big磅来了",
"cmtcount": 154,
"img": "/images/6.webp",
"time": "2019-10-23 00:43:29"
},
{
"id": 8,
"title": "LV母公司史上最大并购:报价145亿美元购Tiffany",
"source": "澎湃新闻",
"cmtcount": 119,
"img": "/images/7.webp",
"time": "2019-10-22 03:59:44"
},
{
"id": 9,
"title": "黄峥1350亿蝉联80后白手起家首富:过去1年财富每天涨1个亿",
"source": "胡润百富",
"cmtcount": 676,
"img": "/images/8.webp",
"time": "2019-10-21 06:19:37"
}
]
}
修改于 2022-10-13 10:42:10