Facebook Graph API - get friends info

前端 未结 6 547
盖世英雄少女心
盖世英雄少女心 2020-12-31 23:40

I\'m trying to figure out how to get users friends information using either Graph API or FQL

Just for testing I would like to get my friends education_histroy<

相关标签:
6条回答
  • 2021-01-01 00:01

    You can use this code you will get name, profile picture, ID of your friends.

    FB.api('/me/taggable_friends', function(response) { for (var i = 0; i < friend_data.length; i++) { results += ''+friend_data[i].name; } });

    Before that in your developer account created app-> go to tools and support->graph API explorer-> click Get Token. In that window click user_tagged_places and click Get Access Token. You will get your friends list.

    0 讨论(0)
  • 2021-01-01 00:04

    Graph API is the smart choice in most cases. To retrieve your friend information you need to collect some extended permissions from the user first. Then you can retrieve a lot more information other than the basic ones.

    Following is a list of extended permissions related to friends different kind of information

    friends_about_me        
    friends_activities      
    friends_birthday
    friends_checkins        
    friends_education_history       
    friends_events
    friends_games_activity      
    friends_groups      
    friends_hometown
    friends_interests       
    friends_likes       
    friends_location
    friends_notes       
    friends_online_presence     
    friends_photo_video_tags 
    friends_photos      
    friends_relationship_details        
    friends_relationships
    friends_religion_politics       
    friends_status      
    friends_subscriptions
    friends_videos      
    friends_website     
    friends_work_history
    

    Hope it helps :)

    0 讨论(0)
  • 2021-01-01 00:09

    I'd suggest that you go to http://developers.facebook.com/docs/reference/api/user/ like most of the others are suggesting but as a general tip, use the friends_education_history as a way to get the friend's history.

    P.S: Minor spelling error in your original question that should be edited. "education_histroy." = education_history in the second line of your main paragraph.

    0 讨论(0)
  • 2021-01-01 00:14

    I've been wrestling with this all day myself and I believe I have figured it out, nowhere in facebook documentation (that I have found) is this clear. And I don't believe the other answers actually answered your question, it looks like you requested permissions correctly. Anyway, to request the information you are looking for, ping the api like this:

    https://graph.facebook.com/userid/friends?fields=work&access_token=ACCESSTOKENHERE
    

    This will return you all the friends' info in one long JSON response.

    It is a little confusing because the permissions you are asking for are not the same thing you need to query the API.

    The query above will return the friends' ids with work history. You can add commas to the fields parameter to include additional info like name, but then the API calls/responses end up taking a long time.

    0 讨论(0)
  • 2021-01-01 00:16

    From this answer to another question: a call to 'me/friends?fields=work' worked for me!

    0 讨论(0)
  • 2021-01-01 00:26

    http://developers.facebook.com/docs/reference/api/user/

    you can get all the fields mentioned here .To get work you need to have user_work_history or friends_work_history permission

    in the link it is mentioned what permissions to obtain before you get the info and another thing that user has to allow your application,this will make your app to get the informations.

    0 讨论(0)
提交回复
热议问题