Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share someone's post using Facebook Graph API

Tags:

My Facebook App posts messages on user wall. I want to share this messages on my wall, same as I click share action under user message. How can I do it using Facebook Graph API?

like image 381
starling Avatar asked Feb 16 '12 07:02

starling


People also ask

How do I use Facebook Graph API and extract data?

To use the Graph API Explorer tool, go to developers.facebook.com/tools/explorer. Generate the access token you need to extract data from the Facebook Graph API by selecting Get User Access Token from the App Token drop-down menu under the name of your app.


1 Answers

Yes, you can share using the graph2 api. The way you do it is to use /feed edge and pass the post's url that you want to share as the link.

POST /v2.2/{page-id}/feed HTTP/1.1 Host: graph.facebook.com  link=https://www.facebook.com/{page_id}/posts/{post_id} 

Standard Fb permissions to the post you are sharing do apply.

https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed

This was done today, in a local rails app, using FbGraph2 gem, with the above method. enter image description here

like image 147
Taysky Avatar answered Sep 21 '22 13:09

Taysky