I'm working with the following Facebook API endpoints: /statuses
, /links
, /photos
For each returned object I'm only getting likes
and comments
objects which display top25 results, and a pagination that leads to the next 25.
I'm only interested in the number of likes. Is there a way to get that number through a different API call which doesn't require multiple pagination calls?
You can return the total number of likes for various objects using FQL. Here's the documentation for how to get the total number of likes for a comment:
https://developers.facebook.com/docs/reference/fql/comment
The query itself would look like this:
SELECT likes FROM comment WHERE post_id = xyx
SELECT like_info.like_count FROM stream WHERE source_id = '<id>'
or
SELECT like_info.like_count FROM stream WHERE source_id = '<id>' and and actor_id = '<id>'
More: https://developers.facebook.com/docs/reference/fql/stream/