Get number of likes on a facebook profile picture (graph api) - facebook

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

Related

Getting Facebook Photo Likes Count Without FQL

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)

Getting user profile pictures without FQL - graph api v2.2

I was using FQL to get all the photos in the user profile pictures album.
Since facebook decided to deprecate FQL in their latest version of graph api, im looking for the easiest and fastest way to get the user profile pictures (all of them)
I was using this FQL:
SELECT object_id, src_big, src_big_height FROM photo WHERE aid in (SELECT aid FROM album WHERE owner = 'XXXX' AND type = 'profile') LIMIT 20"
Any graph method that would get me the equivalent in 1 graph call? (I know i call call for /user/albums and to use the album id later to get the photos, but i don't want to seperate it to 2 calls)
Thanks alot
Ok, the best I could came up was using graph api field expansion:
https://graph.facebook.com/me?fields=albums.limit(1).fields(name,photos.fields(name,picture,source,images))
Im assuming the first album is the profile pictures.
Hope this can help others :)

How to Get Share count of a picture while it says share_count is not a member of photo table

I am using this query and trying to get share count of each pic but it returns an error.
SELECT link, comment_info, like_info, created, pid, src_big FROM photo WHERE aid
IN (SELECT aid FROM album WHERE owner=20531316728)ORDER BY share_count desc
I do want to order the last 20 pictures with there share count. Can somebody help me how could I achieve this.
I am not writing an application. Just testing it in Graph API explorer v2.0 API in developer tools.
This isn't possible because there exists no share_count field in the FQL photo table. https://developers.facebook.com/docs/reference/fql/photo/

Objects I liked in facebook using graph api

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".

Using the Facebook Graphi API, how can I retrieve paginated photos in which my friends are tagged from a specific album?

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