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

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.

Related

Get share count from Graph API efficiently

I am trying to get information about a set of user posts (last 20 posts). For each post, I would like to simply get likes, comments and shares count.
So far I was able to get the like and comment count, but I had no luck in retrieving the share count.
This is the query I used:
https://graph.facebook.com/me?access_token=x&limit=20&fields=id,comments.limit(0).summary(true),likes.limit(0).summary(true)
I understand that there are ways to retrieve the share count using the object id, but I would like to refrain from making 20 different requests in order to obtain this field.
Is there any other way that I can make a single batch request to achieve this?
You can get share count through engagement field of the object, as mentioned here : https://stackoverflow.com/a/5700882/533399
For batching your requests, graph api already supports batch requests :
https://developers.facebook.com/docs/graph-api/making-multiple-requests

getting user likes in facebook

I am trying to get user likes in facebook. I can only get 100 at a time for some reason. i tried using the limit parameter in open graph syntax and it didn't help. I alwso tried writing an FQL query to get more likes and to no avail. No matter what I do, i get only 100 likes per request. It's even worse. Most of the likes are of no interest to me. I'm using only likes on several categories. if i could have gotten (using FQL) 100 likes of a user which are all of those categories, that would have been sufficient to me. But when I call the FQL query it seems that FB is querying on 100 first likes and returning the results instead of returning 100 results. I am despaired at this mechanism, is there a way out of this or is FB really gave no way to get more likes in a single call?
Read about paging in the docs: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2?locale=en_GB#paging
I guess the max limit is 100, if you want to get more than that you have to make another call by using paging. There is no way to filter with the API, you will have to do that on your own after getting the likes.

facebook opengraph api return limitations?

I'm just experimenting with opengraph a bit and I was trying to retrieve all the posts a user has ever made. And I noticed that when do
user_id/statuses?limit=200
it only returns 99 statusses, is this because i'm doing it trough the graph api explorer on developers.facebook.com? is there a way to get all the users posts with the extra information, like in graph(comments/likes...)?
the next/previous links didn't help they both returned an empty json string
there are some limitations enforced here - if a user has (hypothetically) seven million posts, Facebook's servers will be bogged down with your request. All requests have a limitation on them - even if not specifically set. Pay attention to the parameters in the next and prev pagination links. They contain values such as :
limit - how many items will be returned in each request
offset - an offset to start from, an offset of 15 will start returning posts from the 15th and onward.
since - epoch timestamp defining the begining of a timeframe
untill- epoch timestamp defining the end of a timeframe
Hope this info helps...
There is also a limit in the amount of information that Facebook allows to be gotten via the Graph API. The data stores for the public Graph API are not the same as the data stores Facebook uses for the normal GUI. If your app desperately needs full information, it is possible that becoming a Facebook partner might get you better results.

How can I retrieve the full newsfeed of a user via the Facebook API?

I would like to retrieve the full newsfeed including historical data of a given user. In principal, this is straight forward using either an authenticated call to the Graph API or to the FQL API.
With the Graph API, I access the me/home endpoint. This results in 25 entries. I can iterate over the pages and retrieve around 8 pages back into history giving me around 200 entries. I write around 200 entries, because with each run through this I get a different number of total entries. Sometimes more, sometimes less.
With the FQL API, I call SELECT post_id, created_time, actor_id, message FROM stream WHERE filter_key = 'nf' AND is_hidden=0 AND created_time > 1262304000 LIMIT 500 where the created time reflects 1 Jan 2010. This gives me around 150 entries.
Both methods don't seem to allow to work your way backwards into history. In the FQL query, I also tried to play around with the created_time field and LIMIT to go backwards in small chunks but it didn't work.
The documentation of the stream table http://developers.facebook.com/docs/reference/fql/stream/ says somehow cryptically:
The profile view, unlike the homepage view, returns older data from our databases.
Homepage view - as far as I understand - is another word for Newsfeed, so that might mean that what I want is not even possible at all?
To make things worse (but that's not the main topic of this question) the returned datasets from the two methods differ. Both contain entries that the other does not show but they also have many entries in common. Even worse, the same is true in comparison to the real newsfeed on the Facebook website.
Does anyone have any experience or deeper insights on this?
Maybe I am mis-understanding your question, but can't you simply call the graph api with /me/home?limit=5000 and then ?limit=5000&offset=5000 or whatever the max limit value Facebook allows is?

Getting more than 25 photos from the Facebook Graph API

I'm trying to retrieve all the photos a user is tagged in using the Graph API but I can only get the latest 25.
Is it possible to get more, and if so, how?
Have you tried adding a limit and offset parameters? Quoting the documentation:
Paging
When querying connections, there are several useful parameters that enable you to filter and page through connection data:
limit, offset: https://graph.facebook.com/me/likes?limit=3
until, since (a unix timestamp or any date accepted by strtotime): https://graph.facebook.com/search?until=yesterday&q=orange
Currently there is 100 items limitation per query both on photos and likes:
However, 100 pics query takes so much time to run for me.
The following API call:
https://graph.facebook.com/me/photos?limit=500
gives only 100 results with paging link.
Run in FQL explorer (If you have more than 100 pic on your account):
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos%3Flimit%3D500
Setting limit=0 may not always work in the case that a user has a huge number of tagged photos. Also note that the tagged photos graph API can return a large number of embedded comments as well, so especially if you are developing a mobile app, it can take a long time to return all the photo data. Finally I find that sometimes Facebook will limit the number of entries it can return in times of high load.
So... perhaps the best way is to use the "paging" "next" url that appears at the end of the returned photo data. This gives you the next graphAPI call that you can then use to get the next x photos. It does this by using and pre-populating the limit and until parameters and incorporating them within the graph api call. Very handy.