How to execute get_connections

102 views
Skip to first unread message

Chris Johannsen

unread,
Jul 1, 2013, 12:51:51 PM7/1/13
to koala...@googlegroups.com
I'm working on a heroku hosted facebook app to simply get my friends locations and publish on a google map. I can get the data I need from facebook using the graph api call
me?fields=friends.fields(location,first_name,last_name) composed using the graph api explorer, but can't figure out how to execute this query with the get_connections call. I am fairly new to Ruby and looked at the api sources to see if i could figure this out. Any direction would be appreciated.

Thanks in advance.

Folivi Fofo

unread,
Jul 7, 2013, 9:36:57 AM7/7/13
to koala...@googlegroups.com
Hi Chris,

I haven't tried this but it should work:

    @api = Koala::Facebook::API.new(access_token)
    friends = @api.get_connections("me", "friends")

you should get an array of hashes containing the basic data of your friends
 from here you can do something like
for friend in friends
 location = friend["location"]
 firstname = friend["firstname"]
...
end

hope this helps

Reply all
Reply to author
Forward
0 new messages