I am developing an IPhone app. The user can post to his wall and now I want to read ONLY the news feeds that was posted from the IPHone app.
When I use
https://graph.facebook.com/me/feed?access_token=...
I get all wall posts, and I can recognize the one posted from the iphone app by the "application" node in the JSON response. How can I filter those feeds? Should I use FQL instead?
Thanks!!!
Edit: I tried using https://graph.facebook.com/search?q={My application name}&type=post&access_token= with no success...
Yep, FQL is the way forward, you can pass an app_id: http://developers.facebook.com/docs/reference/fql/stream/
So your query could be like: SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id = me() AND app_id = 'my_app_id'
Related
How to compose request which is retrieve wall posts posted by my application or at least I want to get ALL posts posted by any application or user. Now I can see only posts from myself and friends : me?fields=feed with permission read_stream. If it impossible withGraph API how to do this with FQL ?
select message from stream where source_id = DESTINATION ID and app_id= YOUR APP ID
If you want to filter by stuff your app is posting you have to find the id that your app is posting on. This is the "soure_id" ie where your post is going. Then you just have to add the parameter of what your app_id is that your app is posting as. If you wanted to filter by user you would just insert their uid as the actor_id instead of app_id.
I am currently making a Facebook canvas app using Django and Python for Facebook. To be able to make my app I need to retrieve the posts the user have made to his friends' walls. This has proven to be a challenge.
I have tried using the connection user.posts with the graph API like this:
graph = facebook.GraphAPI(access_token)
posts = graph.get_connections('me', 'posts' , limit=5000)
Which in the graph explorer would be something like:
graph.facebook.com/me/posts
The post objects from this request does however not return any posts from the user on his friend's walls.
I also tried an FQL query which didn't return anything, at least not with myself as the user:
SELECT actor_id, message, post_id, source_id, tagged_ids, type
FROM stream WHERE type=56 AND source_id IN (SELECT user_1 FROM friend WHERE user_2=me())
I'm pretty sure that I could get what I wanted if I did a request for each friend separately but that would be too time consuming to be efficiently implemented. Does anyone have any ideas on how to do this in one or two calls?
I've got a facebook page which is publicly accessible. On my website I'd like to display the last post made by this page.
I made a script which uses the facebook php-api and FQL to retrieve the events from the page. But I just can't figure out how to construct a FQL which displays the latest posts from my page. I've seen the stream table and thought I should use it like this:
SELECT created_time,
likes, message, post_id, share_count, type
FROM
stream
WHERE
actor_id = {$page}
LIMIT 5
But that results in the fact I need a Starred/Indexable column. Fair enough, but I can't figure out which starred column to use.
Anybody?
You should use: source_id instead of actor_id
I was wondering if it's possible to get data from apps, such as discussions or extended info through Graph api or FQL? I'm using the PHP sdk, though it shouldn't matter much.
It isn't possible. Can't be done.
I couldn't understand what you exactly want..
But I think if you need information related to app there is a graph api available for this, please refer the documentation from the following link,
http://developers.facebook.com/docs/reference/api/application/
The feed connections of application graph object could get the feed for the application..
If you are not looking for this, can you explain a bit further about what you need exactly.
To get posts and comments from wall of some Facebook application you may test here following FQL query
SELECT
post_id, viewer_id, message, app_id, source_id,
created_time, updated_time, filter_key, attribution,
actor_id, target_id, message, app_data, action_links,
attachment, impressions, comments, likes, privacy,
permalink, xid, tagged_ids, message_tags, description_tags
FROM stream WHERE
source_id = {ID_of_wall_of_your_App}
where url of my app's wall is as follows:
http://www.facebook.com/pages/display_name/ID_of_wall_of_your_App#!/pages/display_name/ID_of_wall_of_your_App?sk=wall
I'll make one more an update later.
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?
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
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 the stream_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 specifying filter_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.
Twitter Tweets on Your Facebook News Feed
GET /fql?q=SELECT post_id, actor_id, message, app_id, attribution FROM stream WHERE filter_key = 'app_2231777543'
Twitter Tweets on Your Facebook Wall
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.
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.