I have successfully retrieved the comments on a specific link using the fql with the following code:
{\"comments\":\"SELECT fromid, text, time, comments FROM comment WHERE object_id IN (SELECT comments_fbid FROM link_stat WHERE url ='http://permalink')\", \"users\":\"SELECT name, id FROM profile WHERE id IN (SELECT fromid FROM #comments)\"}
I want to post new comment and I have the access token of the user, what is the right way to do this using fql?
As far as I'm aware,you can't insert using FQL. FQL is merely a query language used to perform more complex queries than the Graph API endpoints offer allowing you to perform joins etc (Not joins in the traditional sense but using "IN" statements).
You would need to use the graph api and issue a POST request as detailed towards the bottom of this page https://developers.facebook.com/docs/reference/api/link/
Related
I want to find which photo, video, status or other objects I liked in facebook.
Earlier I used fql to search in the like table:
SELECT object_id FROM like WHERE user_id=me() LIMIT 5000
But, in facebook api 2.1, fql is no more supported, so I need to use graph api to replace the above fql.
So, how can I use graph api to get my likes in facebook?
And I need to find who posted those objects also. In fql I used:
SELECT uid FROM status WHERE status_id IN (SELECT object_id FROM like WHERE user_id=me() LIMIT 5000) ORDER BY uid LIMIT 5000
I nee Graph api for the above fql also.
Plese help!
Just call the endpoint "<userid>/likes". This will give you the information. You need the proper permission for it though: "user_likes".
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 need to get page notifications(new comments, new likes, new post likes etc.). Is there any solution that I can make it realtime?
Realtime api doesn't support it.
FQL doesn't support it.
Realtime API does not support it, however FQL does support it. Given a URL, you can always get comments and likes using comment and link_stat tables.
http://developers.facebook.com/docs/reference/fql/comment/
SELECT post_fbid, fromid, object_id, text, time
FROM comment
WHERE object_id IN (
SELECT comments_fbid
FROM link_stat
WHERE url ='http://developers.facebook.com/docs/reference/fql/comment/')
link_stat table has comment_count, like_count etc as well. You have poll for this content, as you will not get realtime notifications.
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
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