how to share page post using facebook api - facebook-graph-api

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.

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

Graph api sharedposts edge
according to the above link "You cannot publish shares of an object using the Graph API."
When you attempt to use the answer provided in Maria Lucinda da Fonseca's post, Facebook graph api responds with a user error message of
"error_user_msg": "One or more of the given URLs is not allowed by the Stream post URL security app setting. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. Read https://developers.facebook.com/docs/facebook-login/security/ to learn more about app settings related to security."
While it is possible to share links using the graph api, sharing facebook links is not allowed.

Related

Retrieve comments from an implementing facebook comments website

I can not get Facebook Graph Api to retrieve comments from websites that implements facebook commenting system.
I want to provide sentiment feedback statistics for various websites. I wanted to retrieve comments from few websites which are implementing facebook commenting system, I found graph API method /{object-id}/comments
which should return set of comments from specific object-id (which is an url of article consisting set of facebook comments?). I keep getting json response with ID only or an error with "(#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review." message. Any feedback on that?
/{object-id}/comments is for objects on Facebook - posts, comments, videos, etc. An external website that uses the comments plugin, doesn’t fall under that to begin with.
What you want, is this here - https://developers.facebook.com/docs/plugins/faqs#faq_1603507626630008:
Can I get comments for a URL via an API?
The comments for every URL can be accessed via the Graph API. Simply make an HTTP GET request to:
https://graph.facebook.com/v2.6/?fields=og_object{comments}&id=<YOUR_URL>&access_token=<YOUR_TOKEN>

photo not in any album facebook

i've noticed that there are some photos that doesn't appear in any albums. This photos are published by fan on a facebook page.
Is there any way to get this photos by the API ?
The API call /feed returns all the posts of the wall, but many of this photo that i seen in the wall on browser doesn't appear in the response of the API.
Any idea ?
Try using below
https://graph.facebook.com/<YOUR_PAGE_NAME>/picture
Hope this help
Kaushik
I use
graph.facebook.com/PAGEID/photos
Permissions Needed: user_photo_video_tags or friends_photo_video_tags.
refer to: http://developers.facebook.com/docs/reference/api/user/ user photos
http://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos
I have a live example of this usage is you wish to test. it is an iframe plugin that feeds the photos for a page. "is not set up for users".
Just replace "anotherfeed" page user name with any page.
https://anotherfeed.com/api.beta.php?type=photos&pageid=anotherfeed&width=350&height=500&limit=20&offset=0

How to share someone's post using Facebook Graph API

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?
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.
According to the permissions for accessing posts via the API, it would appear that you cannot do this as it would require accessing the post of another user's timeline that you don't have permissions/an access token for.
Edit From further reading of the documentation you definitely cannot do this: https://developers.facebook.com/docs/graph-api/reference/v2.2/object/sharedposts#publish

Most liked pages on a domain using graph API

In the insights section on facebook, it's possible to have statistics of the most liked pages on the domain I own.
The question is, is it possible to obtain this list (on a website, not facebook pages) with the graph API, or at least, is it possible to obtain statistics which combines page url and likes count on a given domain ?
I read most of the facebook api doc and it seems that nothing like that exists.
Thanks!

How to get "x is friends with x" in me/home using Graph API & Javascript SDk

is there a way to do this?
Using the me/home json feed, it shows up as a person and just one image of the person they have friended, even if they have friended several.
Is there a way to pull in all the information?
The most efficient way to achieve this is by using the Graph API Real Time Updates, there's no need to pull the home feed. You should be able to subscribe to the "friends" connection of the "user" object you need so your "callback server URL" will be hit by our servers when that user gets new friends (POST Request).
Note that you will only be able to retrieve the user's new friends public information unless they have previously authorized your App.
Please see further documentation at:
https://developers.facebook.com/docs/reference/api/realtime/
Many thanks
Daniel Torvisco - Developer Support Engineer at Facebook