Search code examples
facebook-graph-apifacebook-like

how to get likes counts from a Facebook page using Graph Explorer 2.4


While this question has been asked a lot, I've still haven't find a way to do it. I'm passing this to Graph Api Explorer

40796308305/?fields=feed{full_picture,created_time,message,likes}

this gives me the, Picture to every status, created time , message - user status and likes which gives me array of data and users that likes the status. i'm trying to get count of those users and remember there were a field 'summary' but I don't see it in the JSON Results. Am I missing something with 2.4 api version ? any help will be appreciate.


Solution

  • You need to request the summary:

    /40796308305/?fields=feed{full_picture,created_time,message,likes.summary(1)}
    

    And if you are only interested in the total count, but not the individual users that liked, you might want to set the limit for likes to 0, so as not to request unnecessary data:

    /40796308305/?fields=feed{full_picture,created_time,message,likes.limit(0).summary(1)}