Reputation: 126507
The Facebook Graph API lets you grab a JSON representation of home (News Feed) & feed (Wall).
How do I just get the posts made by my Facebook app?
Upvotes: 4
Views: 18245
Reputation: 1495
Facebook has added support to filter me/home
posts without using FQL by passing the filter
parameter.
For example to get just photos you can do:
me/home?filter=app_2305272732
Full documentation is here: http://developers.facebook.com/docs/reference/api/user/#home
Upvotes: 11
Reputation: 126507
You can now run Facebook Query Language (FQL) queries using the Facebook Graph API (base URL: https://graph.facebook.com
).
Let's say your application is Twitter. Twitter's Facebook application ID is 2231777543.
I came up with the FQL queries below with the help of @danontheline's answer and by carefully reading Facebook's documentation on FQL stream & FQL stream_filter.
The following excerpt is particularly pertinent:
If you specify a
filter_key
from thestream_filter
FQL table or multiple users, results returned will behave like the user's homepage news feed. If only one user is specified as the source_id, you will receive the profile view of the user or page. You can filter these profile view posts by specifyingfilter_key
'others' (return only posts that are by someone other than the specified user) or 'owner' (return only posts made by the specified user). The profile view, unlike the homepage view, returns older data from our databases. In the case of a Page, the profile view also includes posts by fans.
GET /fql?q=SELECT post_id, actor_id, message, app_id, attribution FROM stream WHERE filter_key = 'app_2231777543'
GET /fql?q=SELECT post_id, actor_id, message, app_id, attribution FROM stream WHERE source_id = me() AND app_id = '2231777543' LIMIT 1000
Running these queries with the Facebook Graph API Explorer returns Facebook Graph API post objects (The result set will differ depending on access_token
, privacy, etc.). You can find out more about each post by adding other columns of the stream table to the queries above and/or by simply making another Graph API request to GET /{post_id}
for eache post_id
returned by the FQL stream queries above.
Upvotes: 2
Reputation: 3689
Afaik thats not possible with just the Graph API. But you can just use a FQL statement to retrieve the wall/feed, too. With this technique you are able to resrict it to the posts made by one actor_id (which should be your app ID in this case):
SELECT post_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0 AND actor_id = 'MattDiPasqualesAppID'
Thing here is that it won't return a JSON, but a XML representation of the result. With phps DOM class you are easily able to convert it into a JSON format or any other representation you want to have of the result!
As you might be handling the whole thing with PHP anyway, you also could just take the json array, parse it into an array and filter the array with keys of your appID.
Upvotes: 1