I’m using the koala gem as show in Railscasts episode #361. I’m attempting to get all of the comments of a given Post but Facebook only seems to be giving me back the last 50 comments on the post. Is this a limitation of Facebook’s Graph API or am I doing something wrong?
fb = Koala::Facebook::API.new oauth_token
post = fb.get_object(id_of_the_post)
comments = fb.get_object(post['id'])['comments']['data']
puts comments.size # prints 50
Graph API paginates the result when is a larger number of posts than the limit that is set (in your case 50).
In order to access the next page of results, call “next_page” method:
Also, by looking in source one can see that “get_object” method receives 3 parameters:
This way, you can raise your posts per page to as many posts as you want: