0

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

Jon
  • 766
  • 1
  • 9
  • 27

2 Answers2

1

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!

Sascha Galley
  • 15,711
  • 5
  • 37
  • 51
  • The first link points to a `page`'s data, not a photo, you might want to update your answer. You need to access `/likes` for a photo too. – Ricardo Tomasi Sep 21 '11 at 21:51
0

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.

Community
  • 1
  • 1
Loïc Joachim
  • 89
  • 1
  • 8
  • Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Rohit Gupta Aug 20 '15 at 01:38