I'm trying to get all posts by users on a page with this query :
SELECT post_id, source_id, created_time, app_data, type, actor_id, target_id, attachment, message FROM stream WHERE source_id = MY_PAGE_ID AND actor_id != MY_PAGE_ID LIMIT 50
The requests actually works, but some posts are omitted.
If anyone had also this issue, and know how to solve it, it could be very helpful. If you know also a better way (which works well) to get all posts by users on a page, it could help.
Thanks.
Hi i am using below fql and it is working fine for me. Hope this helps.
https://graph.facebook.com/fql?q=select+post_id,source_id,created_time+**"OTHER FILEDS REQUIRED"**+from+stream+where+post_id+in(select+post_id+from+stream+where+source_id=" **YOUR PAGE ID** ")&access_token="**ACCESS TOKEN**"
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'm building a simple FQL module to pull in comments from any Facebook fan page.
Getting the post_id, message, actor_id seems pretty straightforward.
However the stream documentation does not seem to indicate any way to get the avatar and name.
What I'm doing is:
SELECT post_id, message, actor_id
FROM stream
WHERE source_id = 125938460770575
Which returns FB Id, comments and the post itself.
I need the user info as well to go along with this.
The obvious solution is to just to an extra FQL API call for every single FB Id (actor_id) that appears to get this info, but I assume there is a better way to do it.
Can I please get some hints on how to do this?
You can use an FQL Multi-Query to achieve that – you “name” your queries, and then the second query can refer to values (in this case the user ids) the first query fetched.
https://developers.facebook.com/docs/technical-guides/fql/#multi has an example that is very similar to what you want, except for that it looks up the user names and pics for users attending an event – but to rewrite that for what you want should be no big deal.
Afterwards you only have to match the ids you get for the users commenting on something with the ids from the second query while processing/displaying the data.
The obvious solution is to just to an extra FQL api call for every single fb id (actor_id) that appears to get this info, but I assume there is a better way to do it.
Yes of course, you can do it like this-
SELECT uid,
pic,
first_name,
last_name
FROM user
WHERE uid IN(
SELECT post_id,
message,
actor_id
FROM stream
WHERE source_id = 125938460770575)
Fetch any detail of the user
I am building a web app that allows users to post to Facebook as well as view their news feed (among a bunch of other things).
This: https://graph.facebook.com/me/posts returns way to many records. It returns EVERYTHING.
To limit the results to Link, Photo, Status Message, Post, and Video, I opted to use FQL. I using the following in my call:
SELECT post_id, source_id, actor_id, target_id, message, attachment, permalink, type FROM stream WHERE source_id = me() AND type IN (80,247,46,128,56) AND is_hidden = 0
The problem is that I am getting back only records created by my app.
What am I doing wrong?
Thank you.
Evidently, all that is required is a LIMIT statement. It works fine now that I have added a LIMIT.
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.