小编Web*_*ent的帖子

如何使用Facebook Graph Api基于光标的分页

我没有找到任何关于这个主题的帮助.文件说

基于游标的分页是最有效的分页方法,应尽可能使用 - 游标是指随机字符串,用于标记数据列表中的特定项目.除非删除此项,否则光标将始终指向列表的相同部分,但如果删除项,则无效.因此,您的应用不应存储任何旧游标或假设它们仍然有效.

When reading an edge that supports cursor pagination, you will see the following JSON response:

{
  "data": [
     ... Endpoint data is here
  ],
  "paging": {
    "cursors": {
      "after": "MTAxNTExOTQ1MjAwNzI5NDE=",
      "before": "NDMyNzQyODI3OTQw"
    },
    "previous": "https://graph.facebook.com/me/albums?limit=25&before=NDMyNzQyODI3OTQw"
    "next": "https://graph.facebook.com/me/albums?limit=25&after=MTAxNTExOTQ1MjAwNzI5NDE="
  }
}
Run Code Online (Sandbox Code Playgroud)

我正在使用这种格式进行api调用,如何在循环中浏览所有页面

/* make the API call */
new GraphRequest(
    session,
    "/{user-id}/statuses",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
Run Code Online (Sandbox Code Playgroud)

pagination android facebook-graph-api

13
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

facebook-graph-api ×1

pagination ×1