Facebook FQL is deprecated. I'm currently using it to get the total sum of likes / comments photos have.
I'm doing something like this:
$q = "SELECT like_info, object_id, comment_info FROM photo WHERE object_id IN(".implode(",", $object_ids) .")";
Now that FQL is deprecated, how can I do the same with the graph API ?
This is quite easy with the Graph API:
/{photo-id}?fields=likes.summary(true),comments.summary(true)
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 have a list of Facebook userid-s.
I would like to get the number of likes on their profile picture via Graph API.
Something like:
https://graph.facebook.com/$userid/picture/likes
It's not working (obviously :-))... Unfortunately I can't find anything about this on the Graph API documentation, either. Do you have any idea?
Thank you very much!
Tomi
You can try the following FQL query:
select pid, like_info.like_count from photo where aid in (select aid from album where owner = me() and name='Profile Pictures') and position = 0
I am pretty new to Facebook api's and would like to know if it's possible to fetch the number of likes and also the number of comments for any specific page for a given period of time via the api?
Thanks in advance.
you can use FQL:
e.g.
select comment_count, share_count, like_count from link_stat where url = "http://techcrunch.com/2011/04/12/facebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade/"
you can use this api explorer as your reference:
https://developers.facebook.com/tools/explorer/?fql=select+comment_count%2C+share_count%2C+like_count+from+link_stat+where+url+%3D+%22http%3A%2F%2Ftechcrunch.com%2F2011%2F04%2F12%2Ffacebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade%2F%22
I want to show the photos of an album in my app. Using the graph API i am able to filter and page by month, like below, which is great. I loop trough the results and get the photo for each id. Best of all, the GRAPH API also gives me a 'next' and 'previous' paging link. Very useful.
http://graph.facebook.com/[photo-album-id]/photos/?fields=id&limit=6&since=last month
But now i want to retrieve only those ids filter in two ways:
Only retrieve those in which the user is tagged
Only retrieve those in which the user & his/her friends are tagged.
I couldn't find any way to do this, with the graph API. Is there an alternative via FQL, that still has the paging in there?
Last alternative I can think of is program is in FQL, and do the paging myself.
p.s. I am doing this in Javascript currently.
You can retrieve photos the current user is tagged in in a specific album with this FQL call:
select object_id, src, album_object_id from photo where pid in (select pid from photo_tag where subject=me()) and and album_object_id=somenumber
To retrieve photos in which the user's friends are tagged, for a specific album:
select object_id, src, album_object_id from photo where pid in (select pid from photo_tag where subject in (select uid2 FROM friend WHERE uid1 = me())) and album_object_id=somenumber
As far as I know these results will not be paginated. For a detailed take on how to paginate fb queries see the Facebook Developer Blog: How-To: Paging with the Graph API and FQL
After a little play with the Graph Explorer (https://developers.facebook.com/tools/explorer/) I come up with this solution. You can make a call to Graph API as follows
/me?fields=friends.limit(5).fields(photos.limit(5))
The first limit is for how many friends you want to get and the second limit is how many photos you want from each friend.
At the end of the data there already is the next page URL.
I only tested on the explorer but should work.
Hope that helps,
Doruk
If I put a facebook like button on a webpage, can I use FQL to query the number of users that 'liked' the page?
Yep. Try the following FQL:
SELECT like_count FROM link_stat WHERE url="http://your-web-page-url";
There's more stats available from the link_stat table as well. The table reference is here.