Please disable your adblock and script blockers to view this page

Search this blog

Thursday 16 February 2017

Post to Facebook Page Wall using restfb Graph API in ADF & Java


This is next post working with Facebook Graph API series, Previously I have posted about gettting access token and use it to get Facebook Profile detail and Posting status on your Facebook Timeline using restfb Facebook Graph API

Go through previous posts for better understanding of this blog post

Now this post is about Facebook Pages , Facebook Page is a way to connect people to promote your brand, website, business, cause etc. This post uses no new code , Posting on pages is same as updating status on Facebook Timeline .

The only difference is of access tokens, For Timeline status posting we use User Aceess Token but for managing pages we need to use Page Access Token .

Open Grpah API Explorer and Click on Get Page Access Token



When we ask for Page Access Token, Graph API asks permission to manage pages


Next step is to click on Get User Access Token for some more permissions


As our requirement is to post on pages so for that we need to grant permission for this- publish_pages


Grant permission to Graph API to publish as pages


After this a token is generatd that is user access token with permissions of manageing and publishing as pages
Change in GET Request and write me/accounts to get details of all pages managed by you



Here you can see different access token and id for each page Now use access token and id of any page to post status


Check after clicking on Post button and see on Page


If you want to post on your page wall under visitors post using your name then use User Acees Token and Page Id (ID of page on that you want to post) to post 

Cheers :) Happy Learning

4 comments :

  1. I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information.
    http://buyfblikescheap.com/buy-facebook-fans/

    ReplyDelete
  2. nice blog today face book was mostly communicate to other members
    Thanks for sharing those maximum important blog submission internet internet web sites.
    For more approximately records plese check the website online trainings

    ReplyDelete
  3. Hi Ashish,

    Can we publish any post on other's(suppose my friend's) timeline instead of mine.
    fbClient.publish("me/feed",FacebookType.class,Parameter.with("message", description));
    Instead of above line(Instead of "me/feed") can we use below(userId or emailId+"/feed")
    Suppose I know my friend's facebook Id or emailId through he uses facebook
    fbClient.publish(userId+"/feed",FacebookType.class,Parameter.with("message", description));

    Thanks

    ReplyDelete
    Replies
    1. Hi Pkm

      I have not tried this , I think it is disabled by facebook since february 2013
      Once look at this - facebook - How to post on a friend's Timeline after the February 2013 migration takes effect?

      Ashish

      Delete