Can anyone tell me why I can't get comments from comment table by post_id.
Access token is [redacted]
post_id is 100002553491860_419288394832940
The post has one comment, I can get it from stream table by fql: select comments from stream where post_id = '100002553491860_419288394832940', you can run it in graph api explorer: http://developers.facebook.com/tools/explorer.
Then I tried to get comments of this post from comment table, fql: select text,time,fromid,comment_count,likes,can_like,user_likes,id from comment where post_id='100002553491860_419288394832940', but it returns empty.
Any help is appreciated.
OK for someone may run into the same problem, finally I used stream table to get comments instead of comment table, fql: select comments from stream where post_id='%#'.
Related
I'm syncing Facebook comments to a database and showing the Facebook comment box on a webpage. There are some inconsistencies with what is synced and what is shown in the Facebook comments box.
First I'm getting the comments with an FQL query. The FQL is as follows:
SELECT post_fbid, fromid, object_id, text, time FROM comment WHERE object_id in
(SELECT comments_fbid FROM link_stat WHERE url = 'http://www.storaensometsa.fi/metsa-ja-mina/')
If you run the query in Facebook Graph API Explorer it returns two comments.
Now, if I add a Facebook comment box to the page above (http://www.storaensometsa.fi/metsa-ja-mina/) it shows zero comments (scroll down the page to see the comment box).
Any thoughts why this is happening? Shouldn't there be two comments in the comment box also? Is the FQL query somehow incorrect?
Why really is FQL necessary? You have to write such a complex query to get the comments, where you can easily get them using the Graph API /comments. Here's the API call:
/comments?id={url}
So to get the comments from your url, simply \GET:
http://graph.facebook.com/comments?id=http://www.storaensometsa.fi/metsa-ja-mina/
(you can check the result in the browser)
I am trying to retrieve all comments on a shared LINK.
I have tried FQL on comment table, but that doesn't work since comment table is for comments plugin.
Let me give you an example:
- CNN has shared a link on their page, which has 60 likes and 30 comments.
- I have tried this FQL query, but it returns nothing since it is not from Comments plugin:
FQL: SELECT post_fbid, fromid, object_id, text, time FROM comment
WHERE object_id IN (SELECT comments_fbid FROM link_stat WHERE url =
'http://google.com/')
So any solution on this?
I'm trying to create a feed of latest comments for a website. I don't have any problem getting comments on a per post basis but I don't seem to be able to find any way to get all, or at least the last 10 comments for the entire website.
Obviously I'd like to do this in the simplest way possible and I figured this would be via the Graph API.
Any suggestions appreciated.
Thanks
I think you might have to enter all the URLs, but it can be done via FQL using the comments and link_stat table.
SELECT xid, text, username, time
FROM comment
WHERE
object_id IN
(SELECT comments_fbid FROM link_stat WHERE url IN (All_your_URLs))
Can you try the above and see if it works ?
Reference - Comments & Link_Stat
I have looked through and couldn't find the answer on here...
We are doing a promotional giveaway and have a ton of addresses of people trying to get free stuff. What we want to do is give the people who post most on our facebook wall a better chance of winning.
So I am trying to set something up (I'm guessing using Graphs API/FQL) that will pull the name of the person who posted to our wall or commented on one of our posts. If I can get a list like this, I have enough php/mysql experience that I can create the code to compare the name with the database and weight their entry.
Does anyone have a simple explanation on the code to pull just the names of the people who posted each time?
Thank you so much for your help!!
Using FQL you can get the ids of those who posted on your page wall:
SELECT post_id, actor_id
FROM stream
WHERE source_id = "PAGE_ID"
and those who commented on posts:
SELECT post_id, fromid
FROM comment
WHERE post_id = "POST_ID"
You also should be able to combine them:
SELECT post_id, fromid
FROM comment
WHERE post_id IN (SELECT post_id
FROM stream
WHERE source_id = "PAGE_ID")
Once you have the ids you can simply query: https://graph.facebook.com/USER_ID and get the name of the user.
If you have too many and don't want to issue a request per one you might want to consider using the Batch Requests option.
We use the facebook comment plugin to have comments on our site.
To moderate those, we use this tool: https://developers.facebook.com/tools/comments
However, we want to build our own tool to moderate those comments, and integrate it to our existing software.
I can't find a proper way of doing this. the only way I found out now after hours of research is this FQL query:
select post_fbid, fromid, object_id, text, time from comment where object_id in (select comments_fbid from link_stat where url ='URL_HERE')
That doesn't work because we have thousands of different URL's and I cant query each of them every time to see if there are any new comments.
I need a way to get all (new) comments by just enter our app_id, domain or something like that
How can I do this?
I'm considering doing the same thing- grabbing all user posts for my application. I'm assuming it's a similar task.
For given user, I will scroll through feed and home looking for app posts. For you, you'd go:
`home?fields=comments`
`feed?fields=comments`
And check for "type" and "id" to match your application.
This code queries for all comments xids used by your application:
https://graph.facebook.com/fql?q=SELECT fromid, text, id, time, username, xid, object_id FROM comment WHERE xid IN (SELECT xid FROM comments_info WHERE app_id = {0}) ORDER BY time desc&access_token={1}&format=json