I am newbie to Java and restfb. I am trying to like, unlike and comment on a user and a page post, But cannot find much information in the docs of restfb. I am done with all the oauth process and can even pull the post.
Like a post:
DefaultFacebookClient client = new DefaultFacebookClient(access_token);
client.publish(post.getId()+"/likes", Boolean.class);
Unlike a post:
DefaultFacebookClient client = new DefaultFacebookClient(access_token);
post.getLikes();
// retrieve a specific like, then
client.delete(like);
Comment on a post:
DefaultFacebookClient client = new DefaultFacebookClient(access_token);
client.publish(post.getId()+"/comments", String.class, Parameter.with("message", "Your comment here"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.