RCrowt
RCrowt

Reputation: 961

Using the Facebook Graph API how can find the most liked photo in an album on one of my pages?

Using the Facebook Graph API how can find the most liked photo in an album on one of my pages?

I have access to the page insights if that can be used.

There are 200 photos in each album so I don't want to do an api request for each photo.

Upvotes: 4

Views: 5912

Answers (2)

Skyler McCoy
Skyler McCoy

Reputation: 81

Subsequently you may also find the most commented on.

Here is the code you request:

http://fivespot.me/fblikes.php

$likes = $facebook->api('/'.$picId.'/likes');

However if you are looking to just find out the most liked there is an app already compiled that will do this for you:

http://apps.facebook.com/imanpic/

Upvotes: 1

Cody Caughlan
Cody Caughlan

Reputation: 32748

The Graph API doesnt support querying for an arbitrary set of photos with some criteria. BUT - you can access the Likes object for each Album, which returns a data set representing all the Liked Photos in that Album. You could then just walk that data set and count the number of times you see the same photo Like.

Thus - you just need to issue a Graph API call for Likes sub-object of an Album.

See "Likes" under "Connections" at:

http://developers.facebook.com/docs/reference/api/album/

Upvotes: 0

Related Questions