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.
Related
I faced with the following problem. I would like to know how to get all the posts that has been reshared by my friend using FQL. I use the following query:
SELECT post_id, type, source_id, actor_id, target_id, via_id, app_id FROM stream WHERE source_id=<friend_id> AND via_id LIMIT 0,100
but unfortunately it returns an empty list. At the same time, when I execute the following query for my account I get the list:
SELECT post_id, type, source_id, actor_id, target_id, via_id, app_id FROM stream WHERE source_id=me() AND via_id LIMIT 0,100
I generated a token for all possible permissions. Could someone, please, point me how to solve this problem?
Your both queries are correct.
SELECT post_id, type, source_id, actor_id, target_id, via_id, app_id
FROM stream
WHERE source_id=<friend_id> AND via_id
LIMIT 0,100
It is only that, through the API, you can't access Users from depth 2. For instance, it is impossible to get your friends' friendlist.
If one of your friends shared one of your friend's post, then you will see one result.
If one of your friends shared a random user's post, then no results.
For privacy reasons, the API only allows to access the information in a quite closed circle of friends.
Yeh.. I was wondering about the question as well for some time..
Using Graph API we can get all the links that I have shared..
GET me/links?fields=link
Try this:
SELECT via_id, link_id, caption, url
FROM link
WHERE owner={user_id}
via_id will show you the unique identifier of the original link poster. If via_id=0 you are the original linkposter.
At least it will work for links.
I need to pull the 'Posts by Others' from my Facebook Page and display them on my site. Spent the afternoon fiddling around with the API and was able to see posts made by the page, but not others. Any ideas?
Steve, I just found another solution, you can use the Graph API using FQL.
Just make a call to the following:
https://graph.facebook.com/fql?q=SELECT post_id, created_time , app_data, type, actor_id, target_id, message FROM stream WHERE source_id = YOUR_PAGE_ID AND actor_id != YOUR_PAGE_ID&access_token=YOUR_ACCESS_TOKEN
If you need more variables, you just need to put them after SELECT, and you can check them out here: https://developers.facebook.com/docs/reference/fql/stream
On iOS, you don't need to put the access token in the query. To check how to do it with the latest iOS SDK, see my answer here: https://stackoverflow.com/a/14357179/675486
Got it, they are in the 'feed' field along with posts by the page. I was hoping for something that would just give posts by others, but I can filter out the ones posted by the page.
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'
I've been scouring the docs for a while now and can't seem to find a way to accomplish this. The information is available publicly (on a facebook page ... the link says "View all # shares") but I can't seem to find a way to access this info either via FQL or the graph API.
I know I can get a list of likes for a given post:
https://graph.facebook.com/87236249496_134765166623967/likes
The goal is to get a list of people who've shared -- but there doesn't seem to be the same sort of thing for shares. Am I missing something?
You can do it via "graph.facebook.com/OBJECT_ID/sharedposts" connection:
I figure it out this connection via metadata=1 parameter:
Go to... http://www.facebook.com/ajax/shares/view/?target_fbid=10154612868272801&__a=1
10154612868272801 is Facebook story ID, __a stands for asynchronous.
You will see large amount of text/JSON, it is basically HTML & JS for little popup window. There is portion of text like hovercard.php?id=# where # is Facebook user ID, using preg_match_all you then get all of the user ID's who shared that post.
Eg: 100000541151971 (Eric) and 9204448 (Courtney)...
Unfortunately, you must be logged into Facebook to do first step, figure it out :)
I think you can get the share_count from stream table by FQL query just like
SELECT type, source_id, share_count, permalink, description, post_id, actor_id, target_id, message , share_count
FROM stream
WHERE filter_key = 'others' and post_id = '87236249496_134765166623967'
you can test it https://developers.facebook.com/tools/explorer/
Note: you have to take the read_stream permissions as explained here
Tye this link: https://graph.facebook.com/134765166623967/sharedposts (with a valid access_token)
The id in the link is the wallpost id (87236249496_134765166623967) minus the page id (87236249496) and minus the underscore.
You'll also need the read_stream permission
I know you're looking to get at shares through the post_id, but can you settle for finding shares by page_id instead of post_id?
If you can, then you can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the post author in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that query might get you what you want.
I made a Facebook Application that people use to share links from my webpage to their walls, and now I need to get back a list of the posts made through it during a pediod of time (e.g. from Sep. 4th to Sep. 10th), incluiding their Post IDs.
I am aware that I could save that information at the moment of its publication, but I need some old data that I didn't save that way.
I have tried using FQL, but that requieres to indicate the source_id (Facebook ID of the user's wall where the post is on), which I am not able to know.
The Graph API object for my application doesn't seem to help either, since it doesn't have a connection for the posts made through it.
Any help would be really apreciated, even just a sign in the right direction.
As suggested, prompt the user for read_stream permissions, and then I'd suggest to take the fql route:
SELECT post_id, actor_id, target_id, message
FROM stream
WHERE attribution=[your app name]
AND created_time > [since]
AND created_time < [until]
AND filter_key in (SELECT filter_key
FROM stream_filter
WHERE uid=me() AND type='newsfeed')
It's not likely to be an issue, but be aware that there's a limit in the number of items returned, so if your time span is wide and your users posted a lot, you may have to play with the [until] and [since] a bit more and make several calls to retrieve everything.
Also take a look at the documentation for more information about fields you can query: http://developers.facebook.com/docs/reference/fql/stream/
Prompt the user for read_stream permissions and then query /me/statuses and look for updates from your application.