2

I'm using RestFB facebook API in JAVA. What i need to do is to get: users likes,users friends list, users friends likes.

what is the right flow to do it? Do i need to build an application on facebook that the users will approve and then connect to this application?

I'm very confused with the correct way to implement it :|

thanks!

1 Answer 1

1

There's a step by step guide on facebook developers website.

You have to work with an access token that will allow you to use a user's facebook account. Once you've the access, call the appropriate api with user permission to fetch information like basic profile info, friends list, photo, etc.

The RestFB api is open source and is quite good, I haven't had the chance to work with it yet but before using it create a Facebook application and request an OAuth access token. And then proceed as illustrated on the RestFB page.

Something like this:

   FacebookClient facebookClient = new DefaultFacebookClient(YOUR_ACCESS_TOKEN);
    User user = facebookClient.fetchObject("me", User.class); 
    Page page = facebookClient.fetchObject("cocacola", Page.class); 
    out.println("User name: " + user.getName()); 
out.println("Page likes: " + page.getLikes());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.