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

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.

Related

How to find posts of a facebook page within a certain period of time?

I want to import posts of a page between 07-12-2017 and 10-12-2017.
I have converted the dates to unix timestamps.
https://graph.facebook.com/v2.11/ekantipur?fields=posts.until(1512926148).limit(125)&access_token=MyAccessToken
works and so does
https://graph.facebook.com/v2.11/ekantipur?fields=posts.since(1512666948).limit(125)&access_token=MyAccessToken
But since and until together does not work. It only shows a single id.
Is there an another way to accomplish this task? If yes please reply. Thankyou in advance.
Update here is my updated Url with since and until. Its still not working.
123456/posts?since=07-12-2017&until=10-12-2017
Can you update the original post with your combined Since and Until?
I'm assuming that the SINCE is set to 7/17 and the UNTIL is 10/17, correct? It looks that way from the converted numbers, but I try not to assume it isn't something small like that :). No offense intended.
Looking at the graph API, I am using the page id of one I am the admin of and using since and until and it's coming back with posts between 07-12-2017 and 10-12-2017. I'm wondering if it has something to do with the limit in your urls. What if the limit statements are narrowing things down too much?
I'm just putting this into the graph API and getting the results I'm expecting: (no, my page id isn't 123456)
Granted, I'm not calling it in a url, Graph API is pretty forgiving.

Facebook Graph API - me/accounts/ edge returning too many results and duplicate pages

The Short Version:
I need to get the same list of pages that is shown on the 'Manage Pages' page (www.facebook.com/bookmarks/pages), but the graph.facebook.com/vX.XX/me/accounts edge returns almost twice as many results as I need (not including duplicates and other bad data). Is there a way that I can get exactly the same result set that appears on the 'Manage Pages' page under the 'Pages' heading?
The Long Version:
I've been trying to use the Facebook graph API to get the list of pages that appear under the 'Pages' heading when I go to the 'Manage Pages' page on the Facebook website (i.e. www.facebook.com/bookmarks/pages).
I've been using the graph.facebook.com/vX.XX/me/accounts edge to retrieve the pages, which should work according to all of the resources I can find.
After paging through and collecting all of the results, I should have ~220 unique pages (uniqueness is currently determined with page ids). Instead, the result set I get is something that can only be described as chaotic: 900-930 unique pages (450-550 of which are child location pages of the other ~400 pages), and anywhere from 300 to 11000 duplicate pages. Adding the summary.total_count property to my query reveals that there are aproximately 963 pages under the /me/accounts edge, although I've never successfully retrieved quite that many unique pages.
I've tried a number of things to change my query to get better results to no avail. Some of the things I've tried:
Using the is_place filter. false consistently returns the same 82 results, which is great except I'm looking for ~220. true returns 800-860 results, both too many and inconsistent.
Using the is_business filter. false consistently returns the same 406 results, but that's still twice as many as I'm looking for. true returns 130-160 results, which is closer but still not enough and still inconsistent.
Finding something useful in business_id. I figure out that the /me/businesses edge will give you all of the items under the 'Business Manager' heading on the 'Manage Pages' page. Unfortunately the pages owned by these businesses don't appear in the 'Pages' list.
Which brings me to the question itself: Is there a way that I can get exactly the same result set that appears on the 'Manage Pages' page under the 'Pages' heading?
Any information that can help me understand why I'm getting these massive result sets with so many duplicate items is also welcome, even if it doesn't directly answer the question.

Facebook Graph API - Less Information Retrieved

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.

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.

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.