接口文档
说明:本接口文档中uid和token放在header中请求(auth接口除外),具体参数见每个接口参数说明。所有接口请求都需要在header中加logid(logid尽量唯一,建议格式md5(appid+uid+当前时间戳+随机字符串)
- 接口文档
- 基础接口
- 乐听号接口
- 扩展接口
- 3.3 频道列表
- 3.4 频道偏好
- 3.5 频道偏好设置
- 3.6 频道顺序
- 3.7 频道顺序设置
- 3.8 关注
- 3.9 关注设置
- 3.10 省市区
- 3.11 重大新闻
返回码请参考《全局统一返回状态码(code)说明》
基础接口
1.1 认证
接口名:auth
请求示列:https://app.leting.io/auth?uid=12345&appid=你的appid&app_secret=你的secret
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
uid | string | 是 |
appid | string | 是 |
app_secret | string | 是 |
region | json | 否[地域] |
region格式为:
{
"province":"广东省",
"city":"深圳市"
}
注意:region中的省市必须与省市区接口返回的省市名称一致,如:搜索上海市region参数为{"province":"上海市"},不支持{"province":"上海"};当包含region参数时,会推荐给用户地域新闻
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "03cf9e58acf8bf02b99ee659691dbf86",
"data": {
"token": "46000fca1881c035630d5784fcaccfe2",
"expired_at": 1541001600//token过期时间戳
}
}
说明:当code=401时,请重新请求认证接口,获取token。
1.2 推荐
接口名:news/rec
请求示列:https://app.leting.io/news/rec
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
size | int | 否[返回数量默认10,最大不超过20] |
distinct | int | 是[去重方式1下发去重2听过去重] |
region | json | 否[地域] |
region格式为:
{
"province":"广东省",
"city":"深圳市"
}
注意:region中的省市必须与省市区接口返回的省市名称一致,如:搜索上海市region参数为{"province":"上海市"},不支持{"province":"上海"};当包含region参数时,会推荐给用户地域新闻
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 3,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "f5cff467-2d78-4656-9b72-8e064c373874",//频道ID
"catalog_name": "科技",//频道名称
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图
"source": "看东方",//来源
"source_icon": "https://...",//来源图片
"hot": 0,//是否热点;0否,1是
"tags": "医疗,急救,直升机",
"title": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//标题
"content": "",//nlp
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "01:31"//时长分秒
},
...
]
}
}
1.3 频道
接口名:news/channel
请求示列:https://app.leting.io/news/channel?catalog_id=catalog_id&keyword=keyword
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
catalog_id | string | 是[频道,支持多频道(or关系),频道之间用英文","隔开] |
keyword | string | 否[支持标题/标签/来源搜索] |
size | int | 否[返回数量默认10,最大不超过20] |
distinct | int | 是[去重方式1下发去重2听过去重] |
start_time | 开始时间 | 否[格式:yyyy-MM-dd hh:mm:ss] |
end_time | 结束时间 | 否[格式:yyyy-MM-dd HH:mm:ss] |
region | json | 否[地区] |
region格式为:
{
"province":"广东省",
"city":"深圳市"
}
注意:region中的省市必须与省市区接口返回的省市名称一致,如:搜索上海市region参数为{"province":"上海市"},不支持{"province":"上海"}
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 3,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "f5cff467-2d78-4656-9b72-8e064c373874",//频道ID
"catalog_name": "科技",//频道名称
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图
"source": "看东方",//来源
"source_icon": "https://...",//来源图片
"hot": 0,//是否热点;0否,1是
"tags": "医疗,急救,直升机",
"title": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//标题
"content": "",//nlp
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "01:31"//时长分秒
},
...
]
}
}
1.4 搜索
接口名:news/search
请求示列:https://app.leting.io/news/search
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
keyword | string | 否[搜索关键字] |
source | string | 否[来源关键字] |
publish_time | string | 否[发布日期,格式yyyy-mm-dd] |
region | json | 否[地区] |
distinct | int | 是[去重方式:0不去重,1下发去重,2听过去重] |
size | int | 否[返回数量默认10,最大不超过20] |
region格式为:
{
"province":"上海",
"city":"上海"
}
注意:region中的省市必须与省市区接口返回的省市名称一致,如:搜索上海市region参数为{"province":"上海市"},不支持{"province":"上海"}
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 3,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "f5cff467-2d78-4656-9b72-8e064c373874",//频道ID
"catalog_name": "科技",//频道名称
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图
"source": "看东方",//来源
"source_icon": "https://...",//来源图片
"hot": 0,//是否热点;0否,1是
"tags": "医疗,急救,直升机",
"title": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//标题
"content": "",//nlp
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "01:31"//时长分秒
},
...
]
}
}
1.5 回传
接口名:play/feedback
请求示列:https://app.leting.io/play/feedback
请求方式:POST
注意:action_type=4时,实际播放时长为必填项
请求body:JSON格式,格式如下:
{
"action_type": 3,//该字段不能为空,字段类型:2.点击列表中item,3.播放完成,4.未播完,5.切换tab点击,6.不喜欢,7.喜欢,9.分享
"timestamp": 1514453668,//时间戳
"imei": "357457041364911_f8:01:13:f2:2d:03",//客户端imei,可为空
"os": "android",//操作系统,可为空
"brand": "samsung",//客户端品牌
"clarity": "NORMAL",//预留字段
"log_id": "2314",
"data": [{
"sid": "m6J2LW-4z-H2dtxea5Sv6_voziweppX1K_aGb7fKtdjq3y36awwXd_NeoKgBXD7a",//sid,该字段不能为空
"duration": 138,//播放时长
"ext": {//用户所在地
"district": "浦东新区",//县(区)
"city": "上海",//市
"province": "上海"//省
}
},
{
"sid": "hAQGpxeSe5_e9RR03wPLe9JValwMyM5Ce9OwJR3eayS6byOmUUunPl03ciB1e-8a9",
"duration": 138,
"ext": {//用户所在地
"district": "玄武区",
"city": "南京",
"province": "江苏"
}
}
]
}
返回结果,JSONJ:
{
"code": "200",
"message": "success",
"log_id": "2314"
}
1.6 播放
乐听号接口
2.1 推荐
接口名:lthao/list
请求示列:https://app.leting.io/lthao/list
请求方式:GET
参数 | 类型 | 是否必须 |
---|
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
[
{
"letinghao_name": "好买商学院",//乐听号名称
"letinghao_image": "https://image.leting.io/0b3aa2b9022fa4036eb4fcca0aba9f91.png",//乐听号图标
"description": "关注微信公众号:“好买商学院”(howbuyIE),教你用正确的姿势学理财!",//乐听号简介
},
{
"letinghao_name": "金鹰早报",//乐听号名称
"letinghao_image": "https://image.leting.io/4442ae146e28e6ade95f93dc3dad3c27.png",//乐听号图标
"description": "每天早上六点,金鹰早报听天下。",//乐听号简介
},
...
]
}
2.2 乐听号内容
接口名:lthao/news
请求示列:https://app.leting.io/lthao/news
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
letinghao_name | string | 是 |
distinct | int | 是[去重方式:0不去重,1下发去重,2听过去重] |
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 3,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "",//暂无内容
"catalog_name": "",//暂无内容
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图地址,可能为空(没有封面图)
"source": "好买商学院",//乐听号名称
"source_icon": "https://image.leting.io/0b3aa2b9022fa4036eb4fcca0aba9f91.png",//乐听号图标
"hot": 0,//是否热点;0否,1是
"tags": "",//暂无内容
"title": "7月26日开盘:政策持续“喊话”降低融资成本;公募主动加仓可转债!",//标题
"summary": "",//摘要
"content": "",//暂无内容
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "03:31"//时长分秒
},
...
]
}
}
扩展接口
3.1 早晚报
接口名:/
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
catalog_id | string | 否 |
location | json string | 否 |
type | int | 否[1.早报(默认),2.晚报] |
catalog_id目前只支持:社会(综合类新闻),科技,财经,娱乐,汽车对应的频道id,默认返回社会(综合类)新闻
location地域信息,格式:JSON:{"province":"江苏省","city":"南京市"}
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 1,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "",//暂无内容
"catalog_name": "",//暂无内容
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图地址,可能为空(没有封面图)
"source": "看东方",//来源
"source_icon"": "https://image.leting.io/fbd27ff1ee83a4b607b6d4c03cb3c14d.png",//来源图片
"hot": 0,//是否热点;0否,1是
"tags": "",//暂无内容
"title": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//标题
"summary": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//简介
"content": "",//暂无内容
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "01:31"//时长分秒
},
...
]
}
}
3.2 query
接口名:query
请求示列:https://app.leting.io/query
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
query | str | 否 |
distinct | int | 是[去重方式1下发去重2听过去重] |
注意:本接口自带自然语言理解(NLU)能力,query参数支持“体育”,“体育新闻”,“我想听体育新闻”,“来点热门体育新闻”,“有没有关于中超的新闻”等任何str类型文本,当query为空时,会根据用户历史行为的个人喜好结合当前热点,做个性化推荐
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 3,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "f5cff467-2d78-4656-9b72-8e064c373874",//频道ID
"catalog_name": "科技",//频道名称
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图
"source": "看东方",//来源
"hot": 0,//是否热点;0否,1是
"tags": "医疗,急救,直升机",
"title": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//标题
"content": "",//nlp
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "01:31"//时长分秒
},
...
]
}
}
3.3 频道列表
接口名:news/catalogs
请求示列:https://app.leting.io/news/catalogs
请求方式:GET
参数 | 类型 | 是否必须 |
---|---|---|
subscribe | int | 否[是否返回用户订阅情况0否1是,默认否] |
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "log_id",
"data": [
{
"catalog_id": "fc583bff-e803-44b6-873a-50743ce7a1e9",
"catalog_name": "国内",
"user_subscribe": 0//用户是否订阅1是0否
},
{
"catalog_id": "4905d954-5a85-494a-bd8c-7bc3e1563299",
"catalog_name": "国际",
"user_subscribe": 0//用户是否订阅
},
...
]
}
3.4 频道偏好
接口名:user/subscribe/list
接口说明:获取用户偏好的频道
请求示列:https://app.leting.io/user/subscribe/list
请求方式:GET
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "log_id",
"data": [
{
"catalog_id": "fc583bff-e803-44b6-873a-50743ce7a1e9",
"catalog_name": "国内"
},
{
"catalog_id": "4905d954-5a85-494a-bd8c-7bc3e1563299",
"catalog_name": "国际"
},
...
]
}
3.5 频道偏好设置
接口名:user/subscribe
接口说明:设置用户偏好的频道
请求示列:https://app.leting.io/user/subscribe?catalog_id=f5cff467-2d78-4656-9b72-8e064c373874
请求方式:POST
参数 | 类型 | 是否必须 |
---|---|---|
catalog_id | string | 频道,支持多频道,频道之间","隔开 |
返回结果:JSON
{
"code": "200",//100订阅/取订失败,200订阅/取订成功
"message": "success",
"log_id": "1",
"data":{
"fail":[]//订阅失败的频道ID
}
}
3.6 频道顺序
接口名:user/catalogs
接口说明:获取用户选择的频道及频道顺序
请求示列:https://app.leting.io/user/catalogs
请求方式:GET
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "log_id",
"data": [
{
"catalog_id": "fc583bff-e803-44b6-873a-50743ce7a1e9",
"catalog_name": "国内",//频道名称
"order_by":0//排序,按从小到大排
},
{
"catalog_id": "4905d954-5a85-494a-bd8c-7bc3e1563299",
"catalog_name": "国际",
"order_by":1
},
...
]
}
3.7 频道顺序设置
接口名:user/catalog/set
接口说明:用户个性化选择的频道及频道顺序设置
注意:设置新的频道会删除用户原来的频道,返回频道排序按照参数传入时的顺序
请求示列:https://app.leting.io/user/catalog/set?catalog_id=f5cff467-2d78-4656-9b72-8e064c373874
请求方式:POST
参数 | 类型 | 是否必须 |
---|---|---|
catalog_id | string | 频道分类,支持多频道,频道之间","隔开 |
返回结果:JSON
{
"code": "200",//100设置失败,200设置成功
"message": "success",
"log_id": "1",
"data":{
"fail":[]//失败的频道ID
}
}
3.8 关注
接口名:user/attention/list
接口说明:获取用户关注的来源
请求示列:https://app.leting.io/user/attention/list
请求方式:GET
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "log_id",
"data": [
{
"source_id": "1",
"source_name": "中国娱乐网",
"source_cover":"",//封面图
"intro":"",//简介
},
{
"source_id": "2",
"source_name": "凤凰娱乐",
"source_cover":"",//封面图
"intro":"",//简介
},
...
]
}
3.9 关注设置
接口名:user/attention
接口说明:设置用户关注的来源
请求示列:https://app.leting.io/user/attention?source_name=朝闻天下
请求方式:POST
参数 | 类型 | 是否必须 |
---|---|---|
source_name | string | 来源 |
type | int | 否[1关注0取关,默认1关注] |
返回结果:JSON
{
"code": "200",//100关注/取关失败,200关注/取关成功
"message": "success",
"log_id": "1"
}
3.10 省市区
接口名:regions
接口说明:获取省市区
请求示列:https://app.leting.io/regions
请求方式:GET
返回结果:JSON
{
"code": "200",
"message": "success",
"data": {
"1": {
"id": 1,
"name": "北京市",
"parent_id": 0,
"level": 0,
"children": {
"2": {
"id": 2,
"name": "北京市",
"parent_id": 1,
"level": 1,
"children": {
"3": {
"id": 3,
"name": "东城区",
"parent_id": 2,
"level": 2
},
...
}
},
...
}
},
...
}
}
3.11 重大新闻
接口名:news/major
接口说明:获取重大新闻
请求示列:https://app.leting.io/news/major
请求方式:GET
返回结果:JSON
{
"code": "200",
"message": "success",
"log_id": "1",
"data": {
"count": 3,//返回数量
"data": [
{
"sid": "xeBRaQ9jH30zm8-Y1EKwlTmVbTIP1w0WKOytdIYisj6lF0ySF3AmcJdoQYSGHKVk",//sid,通过sid获取播放链接
"catalog_id": "",//频道ID
"catalog_name": "",//频道名称
"duration": 91,//时长
"image": "https://image.leting.io/dc269f51a59d29e32280c86a91133931.jpg",//封面图
"source": "看东方",//来源
"source_icon": "https://...",//来源图片
"hot": 0,//是否热点;0否,1是
"tags": "医疗,急救,直升机",
"title": "冲刺! 进口博览会:加强进口博览会医疗保障 上海瑞金医院举行空中急救演练",//标题
"content": "",//nlp
"pub_time": 1539222616,//发布时间戳
"updated_at": 1539222616,//更新时间戳
"human_time": "5分钟前",
"hms": "01:31"//时长分秒
},
...
]
}
}