Karol
Karol

Reputation: 8053

How to get facebook friends list with hometown using Graph API?

I know you can get friends list using this url:

https://graph.facebook.com/me/friends?access_token=XXX

But what I see there is a list of friends with ids and names, but I need hometown on this list. I requested friends_hometown permission, and when I run this url:

https://graph.facebook.com/100001986459077?access_token=XXX

then it works ok - I see hometown among all the fields.

But I don't want to call second URL for all the friends (too many times). I would like to get it in one call using first URL. Is there a way to achieve this target?

Notice: I'm not interested in FQL solution as I know it. All I need is graph API valid url to perform this action.

Upvotes: 1

Views: 1957

Answers (1)

Jacob Robinson
Jacob Robinson

Reputation: 146

https://graph.facebook.com/me/friends?fields=id,name,hometown,location&access_token=[access_token_here] will provide you with the list you're wanting.

You will need to ensure the scope for the access token includes the friend's location and hometown in order to retrieve the data for that user's friend data.

Upvotes: 1

Related Questions