Facebook Graph API - Less Information Retrieved - facebook

I have started using facebook API and I have noticed something strange.
I want to make a list with all the people in the guest list of the event: https://www.facebook.com/events/1565045953740088/. As you can see the event has 25k that went to the event, 925 on the maybe status and 19k in the invited status, so a total of around 45k. Using the Graph API Explorer, I have used the following code to retrieve the names of all the people:
GET/v2.4/1565045953740088/attending?limit=5000
GET/v2.4/1565045953740088/declined?limit=5000
GET/v2.4/1565045953740088/maybe?limit=5000
GET/v2.4/1565045953740088/noreply?limit=5000
After scrolling through the pages, and copy-pasting all the results in an excel, the total number of people I am getting is somewhere around 39,839. I am missing around 5k of people. Am I missing something in the code I am using?
P.S. The reason for setting the limit to 5000 and not to e.g. 25000 is because the page would freeze.

Some people can have disabled the Graph API integration for their Facebook account. That means that you will never be able to retrieve information from them; for example their attendance for Events. They are simply ignored from the responses. This could explain for the few thousand people you are missing.
From your side, there is no workaround for this.

Related

How to search Facebook's "invitable_friends" results

I have a Facebook app, and I'd like to allow my users to invite their Facebook friends to my app. The proper endpoint is /me/invitable_friends which is working well. But towards the bottom of that doc page, they recommend implementing a "search box" to filter the results, yet they don't offer any example of how to do this. I've searched around and haven't found anything.
It doesn't appear as though you can pass additional params for filtering the results. Obviously I can filter the results after the fact, but that's not scalable since the API only returns ~20 users at a time. That limit is modifiable (I believe), though it's of course not wise to bump it too high.
So how can I build a search box interface if I can't pass the search text to the endpoint? I must be missing something.
Thanks in advance.
PS - I'm using the JS SDK.
You should probably file a bug.
Based on the documentation the default size is 1000 records (average Facebook friend list size is 300-400)
If you don't see the next parameter at the end of the result under paging then there are no more results.

Graph API bug? /{group-id}/feed endpoint gives inconsistent results

tl;dr getting a group's feed returns inconsistent #s of posts
This apparent bug seems to affect both v1.0 and v2.0 of the Facebook Graph API.
I am an admin of a closed Facebook group with ~1800 posts. I would like to return all of the posts in that group.
To do this, I am calling /{group-id}/feed and following the URL in paging.next. This does in fact return posts, but the results are inconsistent, and usually returns ~150 less posts than are actually in the group (I have independently verified and double-checked this #) .
A base call of /{group-id}/feed, when all paging.next links are followed, yields 1652 posts.
A base call of /{group-id}/feed?limit=10, when all paging.next links are followed, yields 1606 posts.
A base call of /{group-id}/feed?limit=50, when all paging.next links are followed, yields 1687 posts.
Of note, each of the above cases is internally consistent. (e.g. the limit=10 call always returns the same (incorrect) number of posts.)
I have been scouring Google and SO trying to troubleshoot. Some things I've tried:
Variations on the permissions of the access token: using either the max. or min. needed do not resolve the issue.
Isolating language binding bugs: I have written test code in both Go and Node.js, and both experience the same issue.
Using different versions of the api: both 1.0 and 2.0 demonstrate the same issue.
I'm really at my wits end here. I don't know to troubleshoot further. Any ideas?
This is not necessarily a "bug" - it is sort of documented: https://developers.facebook.com/blog/post/478/
In essence the limit is applied BEFORE filtering the results (like deleted posts or visibility) and thus the limit does not always match the number of posts you're getting. Even worse is you can get empty pages within your result set and you'll need to check for a few pages further in the empty space to be sure that nothing is left.
Posts can get pretty sparse when you're reaching back a lot of time because of deleted user accounts and such stuff. So you might get slots of 200 or something where nothing is returned because all the posts there are gone.

Get old Facebook posts from public FB page

For a university research project I need to view some old posts on public Facebook pages from a specific date range (January 22-31 2014.) I was planning just to copy and paste each post but I have run into a problem with some of the pages that generate a very high volume of posts. Facebook will not display past a certain date. Even with scrolling down, at a certain point the posts stop displaying (this is true by month, so it jumps from January 25 directly to December 31 for example).
Here are the pages I am interested in:
https://www.facebook.com/Syrian.Revolution
https://www.facebook.com/Syrian.Truth
I have read about Facebook's Graph API but have had some trouble using it (I don't have a developer's background.) Also the posts are mostly in Arabic so that may be a problem.
I just need the pages' posts, not the comments sections.
Thanks anyone so much for your help, it is very appreciated.
Really depends on what language/environment you're using. As a simplest case, you can just use Graph API Explorer (https://developers.facebook.com/tools/explorer) and make a call:
{{page_id}}/posts
There are a lot of ways you can improve this call for your benefit. For example, you can use a limit parameter to increase the default number of results it retruns.
{{page_id}}/posts?limit=200
By default, this returns a lot of fields, you can limit the fields.
{{page_id}}/posts?limit=200&fields=id,message,created_time
You can visit https://developers.facebook.com/docs/graph-api/reference/page/feed/ to find out which fields are supported.
In order to get results during a certain time-range, you can use the created_time field to determine if a post belongs to a certain time interval.

Best way to get all the posts on a group's wall on Facebook

There is a group on Facebook called Pointless Haiku. I would like to download all of the posts that have ever been posted to the group's wall so I can entertain myself with random haiku for hours. So far I have used the graph explorer with this fql query (is that the right terminology?): 2204535003?fields=feed.limit(10000).fields(message), and it gives me some of the wall posts but not all of them (not even the first 10000, which is the limit I set). I don't have a Facebook app, because the only reason I want to do this is to amuse myself. Once I get all of the posts I'll probably just write them to a file and do some postprocessing with Python.
What is the best way to accomplish this? Do I need to create an app just to do this, if I want to do it programmatically?
About your observation that it gives me some of the wall posts but not all of them (not even the first 10000, which is the limit I set)
I think that the Graph Explorer is meant to be a development and debugging tool (sort of like Python's IDLE) rather that a full-power query engine. As such, I believe that it has its own built-in page-size limit that cannot be over-ridden. I believe that limit is 25. Note that this is not the limit of the number of results that are returned. It is the maximum number of results that will be displayed on one page. Depending on the size of your results set, it may take several, or many, pages to display the entire set.
So... if you are in Graph Explorer, and run a query, and get back your results, if you scroll down to the bottom of the results produced by Graph Explorer, you may see something like this:
"paging": {
"previous": "https://graph.facebook.com/...",
"next": "https://graph.facebook.com/... "
}
If you click on the URL following the "next" label, it will take you to the next page of results. And if you keep doing that, eventually you will click your way through all of the pages with all of your results.
I think that the way to get ALL of your results at a single shot is to submit the GET request (which Graph Explorer has helped you to create and debug) programmatically via (say) a Python script, or some other kind of script.
Just as an example, I used this query to get back a list of all of the messages and comments posted to a Facebook group since January 1, 2015. (I ran this query successfully on May 8, 2016, using Graph Explorer v2.6.)
128791213885003/?fields=name,id,description,owner,feed.since(2015-01-01){message,created_time,comments{from,message,created_time,comments{from,message,comments{from,message}}}}
I hope this helps.
You can use Graph Explorer for that.
/me/groups can bring group ids
/group-id/feed will bring groups feeds
Don't forget to Get Access Token with user_groups permission.

How to access links provided on one's timeline?

I would like to have access to the links one shared on their timeline.
Using the API Graph Explorer, I see there is a way to access "links". However, it returns empty data. I believe that this might have been used when posting links in FB was done in a special way, different than posting "usual" status.
Then, I thought, I should probably get all the stream and filter the data for links. But at that point, I'm a little confused:
There are THREE different actions that seem to provide the very same data:
- https://graph.facebook.com/me/feed
- .../me/posts
- .../me/statuses
Are they actually all the same?
In addition, all seem to provide me information that is not up to date, but is true for some point in the near past. Moreover, I would like to know how I can get the relevant data from the beginning of the FB usage, or at least, for a given period of time.
Do an HTTP Get to me/links to get the most recent links the user has shared.
To limit it to a timeframe, you can do me/links?since=YYY&until=ZZZ.
Or you can use the paging object to get the previous and next url to use to get that other page of data.