• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Getting facebook friend list using graph api V2.5

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to get facebook friendlist using graph api but i won't able to get whole friend list instead i am having list of friends who liked my facebook app.

I have generated facebook app id and secret key by register app on developer facebook.

It was disscussed on facebook developer blog that only friends who installed this app are returned in API v2.0 and higher. total_count in summary represents the total number of friends, including those who haven't installed the app.

I have tried following code :

FacebookClient facebookClient = new DefaultFacebookClient("ACCESS_TOKEN");
User user = facebookClient.fetchObject("me", User.class);
Connection<User> myFriends = facebookClient.fetchConnection("me/friends", User.class);
System.out.println("Count of my friends: " + myFriends.getData().size());
System.out.println("my friends: " + myFriends.getData();


Output :
{
"data": [
{
"name" xyz",
"id": "XXXXXXXXX"
}
],
"paging": {
"next": "xxxxxxxxxxx"
},
"summary": {
"total_count": xxx
}
}


Can i get whole friend list somehow?

Kindly suggest any soultion.





 
Saloon Keeper
Posts: 10642
227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Kunj, welcome to CodeRanch!

You can't do this.

There are some ways to get more friends, but it depends on what you want to do with them.
 
kunj chauhan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Stephan van Hulst ,

Thank you for your interest in my post.

Actually i want to just read facebook friendlist with their email id to show in my application when user logged in with facebook credentials.

I am working with java desktop application and i want to integrate small part of facebook in my app.




 
Stephan van Hulst
Saloon Keeper
Posts: 10642
227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, but that's not possible.
 
kunj chauhan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thank you
 
kunj chauhan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Stephan van Hulst ,

I have noticed that facebook provides connection to desktop and TV in that way it might be possible to have facebook data in desktop application.

I have refereed following link :

https://developers.facebook.com/docs/facebook-login/for-devices

kindly suggest me any solution that would really appreciate.

Please suggest me any link or steps.

purpose : get whole/some facebook friend list.


 
Stephan van Hulst
Saloon Keeper
Posts: 10642
227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is just for logging devices in into Facebook when you can't access Facebook directly through the device's interface. You would still need to use the graph API to actually interact with Facebook, and as we already found out, it's not possible to get a full friend list that way.

The only solution I can think of is to actually browse to the user's friend list and scrape the web page, but this is a less than optimal solution.
 
Get me the mayor's office! I need to tell him about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!