Path: /app/
Method: GET
接口描述:
线上接口地址 http://toutiao-app.itheima.net/
返回已上线接口地址,形如:
{
"route_map":"/",
"static":"/static/<path:filename>",
"user.smsverificationcode":"/v1_0/sms/codes/<mobile:mobile>"
}
键为接口名称
值为接口路径
Path: /v1_0/announcements/:target
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/announcements/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 公告id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 公告id | ||
| ├─ title | string | 必须 | 标题 | ||
| ├─ content | string | 必须 | 内容 | ||
| ├─ pubdate | string | 必须 | 发布时间 |
Path: /v1_0/announcements
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/announcements
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ title | string | 必须 | 标题 | ||
| ├─ id | integer | 必须 | 公告id | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ total_count | integer | 必须 | 公告总数 |
Path: /v1_0/search/histories
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/search/histories
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户Token |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/search
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/search
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | 身份token,非必须 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 | |
| q | 是 | 搜索关键词 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ like_count | integer | 必须 | 点赞数 | ||
| ├─ collect_count | integer | 必须 | 收藏数 | ||
| ├─ total_count | integer | 必须 | 文章总数 |
Path: /v1_0/search/histories
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/search/histories
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户Token |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ keywords | string [] | 非必须 | 搜索关键词 |
item 类型: string |
Path: /v1_0/suggestion
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/suggestion
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| q | 是 | 请求的前缀词句 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ options | string [] | 非必须 | 选项词条 |
item 类型: string |
Path: /app/socket.io/
Method: GET
接口描述:
http://ttapi.research.itcast.cn
"following notify" 关注通知返回字段 user_id, user_name, user_photo, timestamp
"liking notify" 点赞通知返回字段 user_id, user_name, user_photo, art_id, art_title, timestamp
"comment notify" 评论通知返回字段 user_id, user_name, user_photo, art_id, art_title, timestamp
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| token | 否 | eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token token与匿名id必传其一 (不用包含Bearer 前缀) |
| a | 否 | 匿名id |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| msg | string | 必须 | 聊天输入内容 | ||
| timestamp | integer | 必须 | 聊天发送时间戳 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| user_id | integer | 必须 | 执行操作的用户id | ||
| user_name | string | 必须 | 用户名 | ||
| user_photo | string | 必须 | 用户头像 | ||
| art_id | integer | 非必须 | 文章id | ||
| art_title | string | 非必须 | 文章标题 | ||
| timestamp | integer | 必须 | 回复时间戳 |
Path: /app/imtest/:event
Method: GET
接口描述:
http://toutiao-app.itheima.net/imtest/l
http://toutiao-app.itheima.net/imtest/c
http://toutiao-app.itheima.net/imtest/f
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| event | f 或 l 或 c 或 | 通知事件 |
Path: /app/socket.io/
Method: POST
接口描述:
http://ttapi.research.itcast.cn
messageHeaders
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| token | 否 | eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token (token与匿名id必传其中之一)不用包含Bearer前缀 |
| a | 否 | 匿名用户id |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| msg | string | 必须 | 聊天输入内容 | ||
| timestamp | integer | 必须 | 聊天发送时间戳 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| msg | string | 必须 | 机器人回复内容 | ||
| timestamp | integer | 必须 | 回复时间戳 |
Path: /v1_0/user/profile
Method: PATCH
接口描述:
http://toutiao-app.itheima.net/v1_0/user/profile
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| name | string | 非必须 | 昵称 | ||
| photo | string | 非必须 | 头像 base64编码处理 | ||
| gender | integer | 非必须 | 性别,0-男,1-女 | ||
| birthday | string | 非必须 | 生日,格式'2018-12-20' | ||
| real_name | string | 非必须 | 真实姓名 | ||
| id_number | string | 非必须 | 身份证号 | ||
| id_card_front | string | 非必须 | 身份证正面照片 base64编码处理 | ||
| id_card_back | string | 非必须 | 身份证背面照片 base64编码处理 | ||
| id_card_handheld | string | 非必须 | 手持身份证照片 base64编码处理 | ||
| intro | string | 非必须 | 个人介绍 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 用户id | ||
| ├─ name | string | 非必须 | 用户名 | ||
| ├─ photo | string | 非必须 | 头像url地址 | ||
| ├─ gender | integer | 非必须 | 性别,0-男,1-女 | ||
| ├─ birthday | string | 非必须 | 生日,格式 '2018-12-20' | ||
| ├─ real_name | string | 非必须 | 真实用户名 | ||
| ├─ id_number | string | 非必须 | 身份证号 | ||
| ├─ id_card_front | string | 非必须 | 身份证正面照片url | ||
| ├─ id_card_back | string | 非必须 | 身份证背面照片url | ||
| ├─ id_card_handheld | string | 非必须 | 手持身份证照片url | ||
| ├─ intro | string | 非必须 | 个人介绍 |
Path: /v1_0/user/channels/:target
Method: PUT
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 频道id |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| seq | integer | 必须 | 顺序序号 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
Path: /v1_0/user/channels/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 用户频道id |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/authorizations
Method: PUT
接口描述:
http://toutiao-app.itheima.net/v1_0/authorizations
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | refresh_token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ token | string | 必须 | 用户token |
Path: /v1_0/user/followings/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/user/followings/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 目标用户(被取消关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/user/blacklists/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/user/blacklists/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 被拉黑的用户id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/user/channels
Method: PATCH
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| channels | object [] | 必须 | 用户关注的频道列表 |
item 类型: object |
|
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ channels | object [] | 必须 |
item 类型: object |
||
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
Path: /v1_0/user/channels
Method: PUT
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| channels | object [] | 必须 | 用户关注的频道列表 |
item 类型: object |
|
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ channels | object [] | 必须 |
item 类型: object |
||
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
Path: /v1_0/user/channels
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| channels | integer [] | 必须 | 用户关注的频道列表 |
item 类型: integer |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/user/blacklists
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/user/blacklists
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 必须 | 被拉黑的用户id |
Path: /v1_0/authorizations
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/authorizations
1. 201 OK
2. 400 请求参数错误
包括:参数缺失、手机号格式不正确、验证码失效等
3. 507 服务器数据库异常
token用于访问需要身份认证的普通接口,有效期2小时refresh_token 用于在token过期后,获取新的用户token,有效期14天Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| mobile | string | 必须 | 手机号 | ||
| code | string | 必须 | 短信验证码 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | 数据 | ||
| ├─ token | string | 必须 | 用户token令牌 | ||
| ├─ refresh_token | string | 必须 | 用于刷新token的令牌 |
Path: /v1_0/user/followings
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/user/followings
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 必须 | 被关注的用户id |
Path: /v1_0/user/photo
Method: PATCH
接口描述:
http://toutiao-app.itheima.net/v1_0/user/photo
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | multipart/form-data | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 参数名称 | 参数类型 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| photo | file | 否 | 头像 | |
| id_card_front | file | 否 | 身份证正面照片 | |
| id_card_back | file | 否 | 身份证背面照片 | |
| id_card_handheld | file | 否 | 手持身份证照片 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 用户id | ||
| ├─ photo | string | 非必须 | 头像url地址 | ||
| ├─ id_card_front | string | 非必须 | 身份证正面照片url | ||
| ├─ id_card_back | string | 非必须 | 身份证背面照片url | ||
| ├─ id_card_handheld | string | 非必须 | 手持身份证照片url |
Path: /v1_0/users/:target
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/users/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token,可选,登录用户会额外查询是否关了注目标用户 |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 目标用户id |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 用户id | ||
| ├─ name | string | 必须 | 用户名 | ||
| ├─ photo | string | 必须 | 用户头像 | ||
| ├─ is_media | integer | 必须 | 是否是自媒体,0-否,1-是 | ||
| ├─ intro | string | 必须 | 简介 | ||
| ├─ certi | string | 必须 | 自媒体认证说明 | ||
| ├─ art_count | integer | 必须 | 发布文章数 | ||
| ├─ follow_count | integer | 必须 | 关注的数目 | ||
| ├─ fans_count | integer | 必须 | 被关注的数目(粉丝数目) | ||
| ├─ like_count | integer | 必须 | 被点赞数 | ||
| ├─ is_following | boolean | 必须 | 是否关注了用户 | ||
| ├─ is_blacklist | boolean | 必须 | 是否拉黑了用户 |
Path: /v1_0/user/profile
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/profile
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 用户id | ||
| ├─ name | string | 必须 | 用户名 | ||
| ├─ photo | string | 必须 | 头像 | ||
| ├─ mobile | string | 必须 | 手机号 | ||
| ├─ gender | integer | 必须 | 性别,0-男,1-女 | ||
| ├─ birthday | string | 必须 | 生日,格式 '2018-12-20' |
Path: /v1_0/user/followings
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/followings
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数 | |
| per_page | 否 | 每页数量 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ total_count | integer | 必须 | 所有关注的用户总数 | ||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 | 关注的用户 |
item 类型: object |
|
| ├─ id | integer | 必须 | 关注的用户id | ||
| ├─ name | string | 必须 | 关注的用户名 | ||
| ├─ photo | string | 必须 | 头像 | ||
| ├─ fans_count | integer | 必须 | 粉丝数 | ||
| ├─ mutual_follow | boolean | 必须 | 是否互相关注 |
Path: /v1_0/user/followers
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/followings
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数 | |
| per_page | 否 | 每页数量 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ total_count | integer | 必须 | 所有粉丝的用户总数 | ||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 | 粉丝用户 |
item 类型: object |
|
| ├─ id | integer | 必须 | 粉丝用户id | ||
| ├─ name | string | 必须 | 粉丝用户名 | ||
| ├─ photo | string | 必须 | 头像 | ||
| ├─ fans_count | integer | 必须 | 粉丝数 | ||
| ├─ mutual_follow | boolean | 必须 | 是否互相关注 |
Path: /v1_0/user/figure
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/figure
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ fans_count | integer | 必须 | 粉丝数量 | ||
| ├─ read_count | integer | 必须 | 作品被阅读的数量 |
Path: /v1_0/user
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token,必传 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 关注目标(被关注的用户id) |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ id | integer | 必须 | 用户id | ||
| ├─ name | string | 必须 | 用户名 | ||
| ├─ photo | string | 必须 | 用户头像 | ||
| ├─ is_media | integer | 必须 | 是否是自媒体,0-否,1-是 | ||
| ├─ intro | string | 必须 | 简介 | ||
| ├─ certi | string | 必须 | 自媒体认证说明 | ||
| ├─ art_count | integer | 必须 | 发布文章数 | ||
| ├─ follow_count | integer | 必须 | 关注的数目 | ||
| ├─ fans_count | integer | 必须 | 被关注的数目(粉丝数目) | ||
| ├─ like_count | integer | 必须 | 被点赞数 |
Path: /v1_0/user/channels
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户Token,未登录用户为空 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ channels | object [] | 必须 | 频道列表 |
item 类型: object |
|
| ├─ id | integer | 必须 | 频道ID | ||
| ├─ name | string | 必须 | 频道名称 |
Path: /v1_0/sms/codes/:mobile
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/sms/codes/:mobile
每手机号每分钟1次
{
"message": "Too many requests."
}
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| mobile | 18612345678 | 手机号 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| data | object | 非必须 | 数据 | ||
| ├─ mobile | string | 必须 | 手机号 | ||
| message | string | 必须 | OK | 提示信息 ok |
枚举: OK |
Path: /v1_0/user/channels
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/user/channels
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户令牌token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| channels | object [] | 必须 | 用户关注的频道列表 |
item 类型: object |
|
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ channels | object [] | 必须 |
item 类型: object |
||
| ├─ id | integer | 必须 | 频道id | ||
| ├─ seq | integer | 必须 | 顺序序号 |
Path: /v1_0/comments
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/comments
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 评论的目标id(评论文章即为文章id,对评论进行回复则为评论id) | ||
| content | string | 必须 | 评论内容 | ||
| art_id | integer | 非必须 | 文章id,对评论内容发表回复时,需要传递此参数,表明所属文章id。对文章进行评论,不要传此参数。 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ com_id | integer | 必须 | 新建的评论id | ||
| ├─ target | integer | 必须 | 评论所属的目标id | ||
| ├─ art_id | integer | 必须 | 评论所属的文章id |
Path: /v1_0/article/reports
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/article/reports
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 举报的文章id | ||
| type | integer | 必须 | 举报类型: 0-其他问题,1-标题夸张,2-低俗色情,3-错别字多,4-旧闻重复,5-广告软文,6-内容不实,7-涉嫌违法犯罪,8-侵权' | ||
| remark | string | 非必须 | 其他问题 的附加说明 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 必须 | 举报的文章id | ||
| ├─ type | integer | 必须 | 举报类型 |
Path: /v1_0/article/dislikes/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/article/dislikes/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户身份token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/article/likings/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/article/likings/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户身份token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/comment/likings/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/comment/likings/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户身份token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target | 要取消点赞的评论id或评论回复id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/article/collections/:target
Method: DELETE
接口描述:
http://toutiao-app.itheima.net/v1_0/article/collections/:target
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/x-www-form-urlencoded | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户身份token |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| target |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 非必须 | 提示信息 |
Path: /v1_0/article/dislikes
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/article/dislikes
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 不喜欢的文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 非必须 | 不喜欢的文章id |
Path: /v1_0/article/likings
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/article/likings
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 点赞的文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 非必须 | 点赞的文章id |
Path: /v1_0/comment/likings
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/comment/likings
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 点赞的评论id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 非必须 | 点赞的评论id |
Path: /v1_0/article/collections
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/article/collections
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户身份token | |
| Trace | 是 | collect埋点参数 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 收藏的目标文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ target | integer | 必须 | 收藏的文章id |
Path: /v1_0/channels
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/channels
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 必须 | |||
| ├─ channels | object [] | 必须 |
item 类型: object |
||
| ├─ id | integer | 必须 | 频道id | ||
| ├─ name | string | 必须 | 频道名称 |
Path: /v1_0/user/articles
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/articles
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ like_count | integer | 必须 | 点赞数 | ||
| ├─ collect_count | integer | 必须 | 收藏数 | ||
| ├─ total_count | integer | 必须 | 文章总数 |
Path: /v1_0/articles/:article_id
Method: GET
接口描述:
本接口不包含文章评论,文章评论在另外的接口。
http://toutiao-app.itheima.net/v1_0/articles/:article_id
如http://toutiao-app.itheima.net/v1_0/articles/1
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | jwt token | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户身份token,匿名用户无需携带 |
| Trace | 是 | click的埋点参数 |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| article_id | 文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 OK | ||
| data | object | 非必须 | 数据 | ||
| ├─ art_id | integer | 必须 | 文章ID | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ pubdate | string | 必须 | 发布日期 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名 | ||
| ├─ aut_photo | string | 必须 | 作者头像url 无图片,默认为null | ||
| ├─ is_followed | boolean | 必须 | 是否关注了作者 | ||
| ├─ attitude | integer | 必须 | 用户对文章的态度, -1: 无态度,0-不喜欢,1-点赞 | ||
| ├─ content | string | 必须 | 文章内容 | ||
| ├─ recomments | object [] | 必须 | 相关文章推荐,无推荐为空数组 |
item 类型: object |
|
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ tracking | string | 必须 | 埋点参数 | ||
| ├─ is_collected | boolean | 必须 | 是否收藏了文章 |
Path: /v1_0/article/collections
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/article/collections
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ like_count | integer | 必须 | 点赞数 | ||
| ├─ collect_count | integer | 必须 | 收藏数 | ||
| ├─ is_liking | boolean | 必须 | 是否对文章点赞 | ||
| ├─ total_count | integer | 必须 | 文章总数 |
Path: /v1_0/users/:user_id/articles
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/users/:user_id/articles
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
路径参数
| 参数名称 | 示例 | 备注 |
|---|---|---|
| user_id | 用户id |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ like_count | integer | 必须 | 点赞数 | ||
| ├─ collect_count | integer | 必须 | 收藏数 | ||
| ├─ is_liking | boolean | 必须 | 是否点赞 | ||
| ├─ total_count | integer | 必须 | 文章总数 |
Path: /v1_0/user/histories
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/user/histories
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU | 用户token |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ like_count | integer | 必须 | 点赞数 | ||
| ├─ collect_count | integer | 必须 | 收藏数 | ||
| ├─ is_liking | boolean | 必须 | 是否对文章点赞 | ||
| ├─ total_count | integer | 必须 | 文章总数 |
Path: /v1_0/comments
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/comments
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| type | 是 | a或c | 评论类型,a-对文章(article)的评论,c-对评论(comment)的回复 |
| source | 是 | 源id,文章id或评论id | |
| offset | 否 | 获取评论数据的偏移量,值为评论id,表示从此id的数据向后取,不传表示从第一页开始读取数据 | |
| limit | 否 | 获取的评论数据个数,不传表示采用后端服务设定的默认每页数据量 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| target | integer | 必须 | 评论的目标id(评论文章即为文章id,对评论进行回复则为评论id) | ||
| content | string | 必须 | 评论内容 | ||
| aid | integer | 非必须 | 文章id,对评论内容发表回复时,需要传递此参数,表明所属文章id。对文章进行评论,不要传此参数。 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ total_count | integer | 必须 | 该文章的评论总数 或 该评论的回复总数 | ||
| ├─ end_id | integer | 必须 | 所有评论或回复的最后一个id(截止offset值,小于此值的offset可以不用发送请求获取评论数据,已经没有数据),若无评论或回复数据,则值为NULL | ||
| ├─ last_id | integer | 必须 | 本次返回结果的最后一个评论id,作为请求下一页数据的offset参数,若本次无具体数据,则值为NULL | ||
| ├─ results | object [] | 必须 | 评论或回复的内容 |
item 类型: object |
|
| ├─ com_id | integer | 必须 | 评论或回复id | ||
| ├─ aut_id | integer | 必须 | 评论或回复的用户id | ||
| ├─ aut_name | string | 必须 | 用户名称 | ||
| ├─ aut_photo | string | 必须 | 用户头像url | ||
| ├─ like_count | integer | 必须 | 点赞数量 | ||
| ├─ reply_count | integer | 必须 | 回复数量 | ||
| ├─ pubdate | string | 必须 | 创建时间 | ||
| ├─ content | string | 必须 | 评论或回复内容 | ||
| ├─ is_top | integer | 必须 | 是否置顶,0-不置顶,1-置顶 | ||
| ├─ is_liking | boolean | 必须 | 当前用户是否点赞 |
Path: /v1_0/reading/durations
Method: POST
接口描述:
http://toutiao-app.itheima.net/v1_0/reading/durations
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Trace | 是 | read埋点参数 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| duration | integer | 必须 | 阅读时长 秒数 | ||
| art_id | integer | 必须 | 文章id |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 |
Path: /v1_0/articles
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_0/articles
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU |
或者
Anony xxxxxxxxxxxxxxxxxxxx | 用户身份token 或 匿名用户手机识别码 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| channel_id | 是 | 频道ID | |
| page | 否 | 页数,不传默认为1 | |
| per_page | 否 | 每页数量,不传每页数量由后端决定 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ page | integer | 必须 | 当前页数 | ||
| ├─ per_page | integer | 必须 | 每页数量 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ is_top | integer | 必须 | 是否置顶,0-不置顶,1-置顶 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ trace | object | 非必须 | 埋点参数 | ||
| ├─ click | string | 必须 | 点击文章,进入文章详情页时反馈 | ||
| ├─ collect | string | 必须 | 用户点击收藏文章时反馈 | ||
| ├─ share | string | 必须 | 用户分享时反馈 | ||
| ├─ read | string | 必须 | 用户的阅读时长,退出详情页时反馈 |
Path: /v1_1/articles
Method: GET
接口描述:
http://toutiao-app.itheima.net/v1_1/articles
Headers
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
|---|---|---|---|---|
| Content-Type | application/json | 是 | ||
| Authorization | 是 | Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NDMyODQzNjYsInVzZXJfaWQiOjF9.mLYitrKsn4E4KdQd0CNPugKrH8uQmXEQTlG_JutC8jU |
或者
Anony xxxxxxxxxxxxxxxxxxxx | 用户身份token 或 匿名用户手机识别码 |
Query
| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| channel_id | 是 | 频道ID | |
| timestamp | 是 | 时间戳整数 单位毫秒 | 时间戳,请求新的推荐数据传当前的时间戳,请求历史推荐传指定的时间戳 |
| with_top | 是 | 0或1 | 是否包含置顶,进入页面第一次请求时要包含置顶文章,1-包含置顶,0-不包含 |
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
|---|---|---|---|---|---|
| message | string | 必须 | 提示信息 | ||
| data | object | 非必须 | |||
| ├─ pre_timestamp | integer | 必须 | 请求前一页历史数据的时间戳 | ||
| ├─ results | object [] | 必须 |
item 类型: object |
||
| ├─ art_id | integer | 必须 | 文章id | ||
| ├─ title | string | 必须 | 文章标题 | ||
| ├─ aut_id | integer | 必须 | 作者id | ||
| ├─ aut_name | string | 必须 | 作者名称 | ||
| ├─ comm_count | integer | 必须 | 评论数量 | ||
| ├─ pubdate | string | 必须 | 发布时间 | ||
| ├─ is_top | integer | 必须 | 是否置顶,0-不置顶,1-置顶 | ||
| ├─ cover | object | 必须 | 封面 | ||
| ├─ type | integer | 必须 | 封面类型,0-无封面,1-1张封面图片,3-3张封面 | ||
| ├─ images | string [] | 必须 | 封面图片 |
item 类型: string |
|
| ├─ trace | object | 非必须 | 埋点参数 | ||
| ├─ click | string | 必须 | 点击文章,进入文章详情页时反馈 | ||
| ├─ collect | string | 必须 | 用户点击收藏文章时反馈 | ||
| ├─ share | string | 必须 | 用户分享时反馈 | ||
| ├─ read | string | 必须 | 用户的阅读时长,退出详情页时反馈 |