User's history and pagination with Deezer APIs

大憨熊 提交于 2021-01-29 03:32:10

问题


if I try to get the streaming history of a user, e.g.

http://api.deezer.com/2.0/user/.../history?access_token=...

I get the first result page but I don't see any method/parameter (like next, page, ...) to see the rest of the results.

How can I get the following result pages?

Thanks.


回答1:


There are two parameters available to control the paging of data:

  • limit: the number of individual track objects that are returned in the request.
  • index: the individual track objects at the specified index that is the first result of the request to be returned.

Please, compare these two requests to get a better understanding of the paging system:

  • http://api.deezer.com/user/YOUR_USER_ID/history?access_token=YOUR_ACCESS_TOKEN&index=0&limit=10 will return the 10 latest tracks you listened to.
  • http://api.deezer.com/user/YOUR_USER_ID/history?access_token=YOUR_ACCESS_TOKEN&index=4&limit=5 will return the 5 tracks before the 5 latest tracks you listened to.

For your information, you cannot return more than 50 individual objects per page.



来源:https://stackoverflow.com/questions/19430394/users-history-and-pagination-with-deezer-apis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!