0

I want to fetch the public posts from a user(not page) using restfb. I have added all permission in User Data Permissions and Extended Permissions in Graph API Explorer. Still i am not getting the results.

But i can take the posts from a page using following code:

Page page =facebookClient.fetchObject("https://www.facebook.com/FacebookDevelopers",Page.class);
        Connection<Post> pageFeed = facebookClient.fetchConnection(page.getId() + "/feed", Post.class);
        while (pageFeed.hasNext()) {
            pageFeed = facebookClient.fetchConnectionPage(pageFeed.getNextPageUrl(),Post.class);
            for (List<Post> feed : pageFeed){
                for (Post post : feed){     
                    System.out.println(post.getMessage());
                }
            }
        }

What should i do to get the posts of a User?

din_oops
  • 698
  • 1
  • 9
  • 27
  • 1
    First of all, `/FacebookDevelopers` is a page, not a user profile (be aware of the difference.) And secondly, although I don’t know what SDK you are using here, normally API requests are not made using the full facebook.com address, but the user id or page name only. – CBroe Aug 20 '15 at 17:00

1 Answers1

1

See the example usage here: https://github.com/restfb/restfb/blob/master/source/example/com/restfb/example/GraphReaderExample.java.

The fetchObject call should be:

Page page =facebookClient.fetchObject("FacebookDevelopers",Page.class);

That will fetch the page (note: not an User profile).

If this is still not working, please show the erorr/data that you receive. Without that it's very hard to help you.

Roemer
  • 3,566
  • 1
  • 16
  • 32