Jon
Jon

Reputation: 784

Number of likes for a photo or album thru the API

Is it possible to get the number of likes for a photo or album using facebook's API?

This is a link to the open graph for an album

http://graph.facebook.com/99394368305

but it doesn't have the number of likes.

on facebook, you can see it has 2475+ likes

http://www.facebook.com/media/set/?set=a.99394368305.88399.40796308305

thanks

Upvotes: 0

Views: 3608

Answers (2)

Loïc Joachim
Loïc Joachim

Reputation: 109

Try to use something like this as the URL to fetch what you need:

https://graph.facebook.com/albumID/photos?fields=id,likes.summary(true),comments.summary(true)&access_token=XXXXXX

Here is a post that explains how in detail.

Upvotes: 0

Sascha Galley
Sascha Galley

Reputation: 16091

To get the likes for a photo is easy, as you can see in the API Reference:
http://developers.facebook.com/tools/explorer/?method=GET&path=20531316728

For an album you can use the likes connection to get all members who liked that album. So, in your case:

http://graph.facebook.com/99394368305/likes

Notice that that won't return the count. You have to manually go through the results and count the likes. So you should definitely cache the results!

Upvotes: 1

Related Questions