Webbr88
Webbr88

Reputation: 89

Pulling data from Facebook Graph API 2.0 Object

I'm working in Koala with Facebook's Graph API 2.0. Now when you call user_friends using

<% @friends = @graph.get_connections("me", "friends") %>

You should get an object that contains something like the following:

    {
  "data": [
    {
      "name": "Friend 1", 
      "id": "xxxxx"
    }, 
    {
      "name": "Friend 2", 
      "id": "xxxx"
    },
  ], 
  "paging": {
    "next": "https://graph.facebook.com/v2.1/...."
  }, 
  "summary": {
    "total_count": number of friends
  }
}

My question is how do I pull the information from summary. I tried printing this in my ruby app but I only saw the following:

[]

Does that mean the return was nil? I tried to call @friends.summary, but that didn't work

Thoughts?

Upvotes: 0

Views: 283

Answers (1)

andyrandy
andyrandy

Reputation: 73984

https://developers.facebook.com/docs/apps/changelog

The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.

Also make sure you authorized yourself with the user_friends permission, of course.

Upvotes: 1

Related Questions