Posting a Facebook status update
In this recipe, you'll learn how to post a status update on a Facebook user's Timeline from a Spring web application.
Getting ready
This recipe uses the code from the Connecting to Facebook recipe.
How to do it…
Here are the steps to post a status update on a Facebook Timeline:
- In the
FacebookController
class, in thelogin()
method, addpublish_actions
to thescope
parameter:params.setScope("public_profile, publish_actions");
- In the
fb()
method, in theif(facebook.isAuthorized())
block, use the Facebook object to post the status update:facebook.feedOperations().updateStatus("This was posted from a Spring web application.");