how to share page post using facebook api

May Bogus picture May Bogus · Jan 10, 2014 · Viewed 8k times · Source

There is very good and simple answer for question "how to hide page post using facebook api". Thanks a lot. Question "i want to share friend's post via graph api" still has no answer. How come?! :)

Does anybody know how to share Post (via Graph API) from some Page (on any possible destinations: Your timeline, friends timeline, in a group …)?! Any reference to Facebook documentation will be highly appreciated.

Answer

May Bogus picture May Bogus · Jan 15, 2014

Thanks to Maria Lucinda da Fonseca: https://groups.google.com/forum/#!topic/restfb/a94wO_KyZUM

String _destination = "me/feed"; // or "Page_id/feed"
String _linkToPost = ...;// here should be FQL stream.permalink see link to FB doc below
FacebookType publishMessageResponse =
  facebookClient.publish(_destination, FacebookType.class,
    Parameter.with("message", "Your message is here"),Parameter.with("link", _linkToPost ));

Also, you can share a LINK by exactly the same way: just change _destination to "me/links" or "page_id/links" and replace _linkToPost with real URL from browser or FQL link.url

FQL STREAM object

FQL LINK object