Skip to content

获取用户播放记录 ​

登录后调用此接口,传入用户 id, 可获取用户播放记录

接口信息 ​

项目值
接口地址/user/record
请求方式GET / POST
需要登录是
对应模块user_record
文档分类听歌记录

请求参数 ​

参数类型必填默认值说明
uidstring✅-用户 id
typestring—-type=1 时只返回 weekData, type=0 时返回 allData

HTTP 示例 ​

bash
GET /user/record?uid=32953014&type=1

编程式调用 ​

ts
import { userRecord } from 'hana-music-api';

const result = await userRecord({
  uid: '32953014',
  type: '1',
});

console.log(result.body);

返回内容 ​

正文带 code,以及 type 对应的 allData 或 weekData。两个列表都是“可以没有”的路径:缺失或 null 时照常返回;出现时每一项按 playCount、score、song 校验,缺 song 会报 502。song 是记录里套着的歌曲,song.id 宽松。结构定义和类型是 UserRecordBody,见 返回体结构。

补充说明 ​

说明 : 登录后调用此接口,传入用户 id, 可获取用户播放记录

必选参数 : uid : 用户 id

可选参数 : type : type=1 时只返回 weekData, type=0 时返回 allData

接口地址 : /user/record

调用例子 : /user/record?uid=32953014&type=1

Released under the MIT License.