Jason Senger
Jason Senger

Reputation: 11

get Post like count with Facebook AP

i am trying to retrieve a facebook POSTs information (ie: LIKE count) using the facebook API

The URL which used to work was in this format:

https://graph.facebook.com/?ids=[AUTHOR_ID]_[POST_ID]

(author and post ID omitted on purpose)

Now it returns a false data feed. Has the URL structure to retrieve POST information changed?

Upvotes: 0

Views: 2077

Answers (2)

Mihai Serban
Mihai Serban

Reputation: 261

With October 2013 Breaking Changes, likes.count field is no longer available in the feed.

You need to make a call for each POST_ID with the summary field enabled.

https://graph.facebook.com/POST_ID/likes?summary=true&access_token=XXXXXXXXXXXX

There will be a "summary" element with a "total_count" field.

Upvotes: 1

Igy
Igy

Reputation: 43816

Nope, that still works for me - just tested with one of my posts:

 "id": "<SNIP>", 
   //removed most fields
   "actions": [
    {
      "name": "Comment", 
      "link": "https://www.facebook.com/X/posts/Y"
    }, 
    {
      "name": "Like", 
      "link": "https://www.facebook.com/X/posts/Y"
    }
  ], 
  "type": "photo", 
  "status_type": "added_photos", 
  "object_id": "SNIP", 
  "application": {
    "name": "Facebook for Android", 
    "namespace": "fbandroid", 
    "id": "350685531728"
  }, 
  "created_time": "2012-10-12T06:52:10+0000", 
  "updated_time": "2012-10-12T07:48:34+0000", 
  "likes": {
    "data": [
      // four likers' details
    ], 
    "count": 28
  }, 
//snip

Check you still have read_stream Permission from your user, that the post hasn't been deleted, etc

Upvotes: 0

Related Questions