Nick Browne
Nick Browne

Reputation: 13

Getting friend user id, and their photos

I am doing some research into the capacity of Facebook Connect. I have some questions on how a couple of bits of functionality.

  1. Is it possible to fetch a list of all friends of a user?

The idea of this is that a user would log in using my site and then they could search through their friends and select one, and the site would get that friends users id and store it to the sites database.

  1. Getting a photos from that user

After getting the friends user id, would it then be possible to get their photos? Or would the friend need to give the site permission to do that?

I am looking into a site where you can buy a greetings card for a friend, and i wanted to know whether my users would be able to login via facebook, pick a friend, get a photo and then at the time of their birthday it would send them a private message (which i think i know how to do) linking them back to my site where they could view the birthday card and their photo.

Thanks

Upvotes: 1

Views: 3263

Answers (1)

Matthew Johnston
Matthew Johnston

Reputation: 4439

To answer your questions:

  1. Yes. Once you have an access token from the login process for a user, make a Graph API request to https://graph.facebook.com/me/friends. You can test this for yourself here: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends

  2. Yes. During the login process, you must request user_photos and friends_photos permissions after which you can use the access token for a Graph API request to https://graph.facebook.com/USERID/photos. This will only return those photos for a friend which the user is allowed to see for the current privacy settings.

Upvotes: 2

Related Questions