Facebook API graph - max 25 public events of a page - facebook

I'm trying to get all public events of a users page. Now I realized that Facebook API graph only returns a maximum of 25 events of one page.
Is there a way to get all of them?

You need to implement paging: https://developers.facebook.com/docs/graph-api/using-graph-api/#paging
There will be a "next" link in the API result, which is the API call for the next 25 items. You can also use the limit parameter to get more items per call.

Related

Facebook graphapi page/feed returning items sorted by relevance instead of recent activity

Hi I am using the Facebook graph api tool and attempting to get the feed of a public page. I want to get most recent comments first. However the feed returns comments and replies sorted by "relevance", is there a "sort" I can apply or how do I change this to get recent comments and replies within my posts?
I do not own the page I am getting the feed from.
There's the order parameter for comments, which can have the following values:
chronological
reverse_chronological
See
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5#ordering
As far as I know, the feed's posts will always be sorted by created_time, and there's no way to influence this via the Graph API requests.

Count facebook page posts likes

I was reading the fb api doc but I couldn't find a lot about the different type of queries you can build.
Im trying to count all the likes in the posts from certain facebook page of the day.
Does the API supports params like the date or Will I have to take a whole response like the one I get with this request and somehow sum the counts of the likes?
https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)&access_token=XXXXXXX
Thanks
most graph api queries support a since, until params
you can try this based on your example
https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)&access_token=XXXXXXX&since=2015-08-25&until=2015-08-26

What is facebook's Page / Checkin Pagination limit on search?

I can't seem to find it in the documentation anywhere, and only seem to return 50 results when querying.
https://graph.facebook.com/search?q=coffee&type=place&limit=100&offset=200
Any and all requests to Facebook's API has a default limit of 50. You can add a limit=X parameter to any request you make to the Graph API.
For example, to get 300 results from a users feed, you would use something like this:
https://graph.facebook.com/USER_ID/feed?limit=300

Getting less than expected results using facebook graph api

i am getting post or feed results using the webservice
$jsonStr = file_get_contents('https://graph.facebook.com/'.$fbName.'/posts?access_token='.$accessToken.'&limit=30');
what I notice though is that if I set the limit to 30.. i seem to get about two results.
if i set to 500, i will get maybe.. 80? and the load time will be significantly longer. Is this because it's only showing me the public posts but querying all of them? I would like to show as many posts as possible while keeping the load time to a minimum..
Facebook Graph API uses paging for the bigger results. You should read about the paging API of the Facebook Graph API. Most of the case, because of the paging , facebook API returns fewer results.
Facebook Graph API Paging

what is the limit for the # of returned objects in graph.facebook.com/me/likes?

I need to get ALL user likes at once without pagination.
I could hit: graph.facebook.com/me/likes ...however, is there a limit to the # of objects returned by facebook? if so, what is that limit and can it be overwritten?
The default limit is something like 25 results. You can specify a limit by providing a limit parameter to facebook:
https://graph.facebook.com/me/likes?limit=100
Checkout the API Documentation under the heading "Paging".
That said, there's never a guarantee that you'll get all the likes at once, even if you set the limit parameter to be greater than or equal to the number of likes on an object.
On top of that, you'll often find that the number of likes reported on the Facebook website or by the Graph API is higher than what you can get by fetching the /likes connection in the Graph API. I'm trying (and failing) to find the SO question that talked about why that is, but if I remember right that number sometimes includes shares and other actions, not just likes.
You should use the pagination to page thru all the data that the Graph API can return.