dongling5411 2013-03-12 08:56
浏览 35
已采纳

Facebook Graph API分页没有给出确切的结果?

I am using the Graph API to fetch data for a specific query.

function getFeed($access_token,$until)
{
  $result = $this->facebook->api(
    '/me/home', 
    'GET', 
    array(
      'access_token' => $access_token,
      'limit' => 5,
      'until' => $until
    )
  );
  return $result;
}

I'm calling this function through jQuery and fetch 5 post in every call. But it is not giving exact result after two-three calls. than It goes two-three days before(for e.g 1 day ago to direct 4 days ago , for e.g today is Tuesday so it will give feeds of Tuesday than it skips Monday and directly jump to Sunday's feed). And then it will stop giving data and give the empty result.

If i increased the limit from 5 to 25 then it will give some what accurate result but than it will give me only last 5 days posts and not more than that and then it will give empty result

  1. So is there any limit that how much data we can fetch at times with graph API?

  2. Is it good to fetch more posts on one call ? ( for e.g from 5 to 25 or more that that) does it make any difference?

  3. Which is the best practice to paginate in Graph API?

  • 写回答

1条回答 默认 最新

  • duanfu3634 2013-03-14 12:45
    关注

    In regards to first & second question,

    Its not in documentation but personally I have tested following for my project.

    Facebook limit is limited to 500 posts. No matter you put a limit higher than 500 it will fetch only 500 results max. Try with 500 (or more), you will get maximum posts.

    You wont get 500 posts every time but will get above 490 posts in general. Some posts get filtered by various reasons (like privacy, blocked user, not suitable for specific region and other things)

    For more details check Facebook Open Graph API: weird behavior of parameter limit while getting a paginated user's news feed

    In regards to third question,

    http://developers.facebook.com/blog/post/478/

    Want to increase your knowledge about graph api checkout Graph API examples for facebook application development

    may this help you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题