1

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?

Viral Solani
  • 840
  • 1
  • 9
  • 31

1 Answers1

4

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.

Community
  • 1
  • 1
Tony Stark
  • 8,064
  • 8
  • 44
  • 63
  • @ViralSolani i have no access of facebook in my office so if you have any confusion or query just comment below. – Tony Stark Mar 14 '13 at 13:03
  • @advit Thanks for the reply.. but I'm not able to fetch 500 posts..I'm getting the right until(timestamp) value. I've tested it in graph api explorer and their also i got empty result. I can go up to 125 post max. why is this so? do you think FQL is good option instead of graph API to get the accurate data? – Viral Solani Mar 15 '13 at 04:48
  • @ViralSolani In Graph Api some posts are not shown because of privacy, blocked user, not suitable for specific region and other things. In FQL Query this will not happened but don't exactly know about limit check one link for limit in fql query http://stackoverflow.com/questions/4062085/facebook-fql-stream-limit – Tony Stark Mar 15 '13 at 06:28
  • @ViralSolani you are getting or not??? FQL Query is better because its shown all posts... but limit is less... – Tony Stark Mar 15 '13 at 07:18
  • yes Its true..I've also tested in graph api console.So Fql is not good enough for my requirement. And yes i can understand they may not shown some post because of privacy.but then how can i go up to maximum days before? lets say if i want to see feeds before 15 days ago from now??? that is the issue.. and I can go up to only 5 days before. – Viral Solani Mar 15 '13 at 09:41
  • @ViralSolani check this link http://developers.facebook.com/bugs/373942835994630?browse=search_5146b7867303c4630680585 & http://developers.facebook.com/bugs?search_view=search&search_ids=240121102686773&search_statuses=open from my research i think its not happened but still some confusion.. – Tony Stark Mar 18 '13 at 06:48
  • @advit.. we have 3 days left to end the bounty..if no one will give you the perfect answer than I'll award it to you.. – Viral Solani Mar 18 '13 at 07:29