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?
See the example usage here: https://github.com/restfb/restfb/blob/master/source/example/com/restfb/example/GraphReaderExample.java.
The
fetchObject
call should be: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.