I have used Facebook Comments plugins in my website. Now I want to fetch all comments in a page. I have followed this article. But i am getting the following error.
GET Request to
https://graph.facebook.com/comments?id=https://www.example.com/page&access_token=my_fb_access_token
Response Error
Message => (#100) Tried accessing none existing field(comments) on type (URL)
Code => 100
Related
Is there still a way to get Facebook comments from a site URL using Graph API?
I tried converting a site URL to an object-id, but it failed using Graph API Explorer.
Some older posts mention using /{object-id}/comments, some mention ?id=https://she.hr/nevjerojatni-spoj-dragocjenih-bisera-i-pouzdane-njege-uz-nivea-pearlbeauty-black-antiperspiranate/&fields=og_object{comments{message,from{name,%20picture}}}
But I couldn't get a single comment.
I also found fb_comment_id in comments' IFRAME, but couldn't get data on that one either on Graph API explorer (using /{comment_id}).
I was wondering if there is any option to loop on comments of a certain post?
for example I'm trying to loop on the comments for a post that looks like
https://www.facebook.com/{publisher_name}/posts/{post_id}
I came across the facebook graph api but failed any example I tried.
I'm using the Graph API Explorer facebook provided on https://developers.facebook.com/tools/explorer/
and tried getting the post object failed every time
GET/v2.8/{publisher_id}_{post_id}
leads to message "Unsupported get request. Object with ID '{publisher_id}_{post_id}' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
when trying to reach the post just by using the post id I get "(#12) singular statuses API is deprecated for versions v2.4 and higher"
I'm developing a referral application where users can refer their Facebook friends using a referral code. I'm using Facebook Javascript SDK. The problem I'm facing is that the send method works only for particular URLs, I mean if I change the users referral token in link parameter it gives me error 100 invalid link.
Here is the method :
FB.init({appId: app_id, xfbml: true, cookie: true});
FB.ui({
to : '********',
method: 'send',
name: 'Message',
link: 'example.com/emp?token=fAiS1ywL0lS8cUYtgLjk',
redirect_uri:'http://example.com'
});
For some particular link values it works fine but if the token is changed it fails with invalid link error.
I'm stuck with fixing this issue. Am I missing something?
Duplicate of Facebook FB.ui send dialog intermittently returns invalid link error.
For your second question related to the og:url meta, to simplify you have to provide the URL of the current page.
The Open Graph Protocol says:
og:url - The canonical URL of your object that will be used as its
permanent ID in the graph, e.g.,
"http://www.imdb.com/title/tt0117500/".
To understand how those metas work you can check how News websites implement this with the Facebook Object Debugger.
For example this link shows you the implemention of metas for a well-known newspaper website.
I've put a Facebook social plugin comments box on my site, in which i specified a Facebook Fanpage, as the comments target.
Now what I want to do is get all comments that are present in the comments box on page my page. I'm using this:
https://graph.facebook.com/comments/?ids=xxx
In place of xxx I placed my fanpage url (displayed comments just from one day even with limit set to 10000) and when this didn't work I tried my page url, which resulted in nothing being displayed.
The correct syntax to read comments from the Facebook Graph API is as follows:
GET /{object-id}/comments
So your URL would look like this:
https://graph.facebook.com/xxx/comments
Here's a live example that looks at comments on Coca-Cola's cover photo:
http://graph.facebook.com/10152297032458306/comments
You can read more about reading comments via the Graph API here.
check this stackOverflow topic
You need to call it from a secure request https and provide an access_token (19292868552_118464504835613 is Facebook post) :
( (19292868552) is the page or group id and (118464504835613) is the post id)
https://graph.facebook.com/19292868552_118464504835613/comments?access_token=XXX
EDIT:
Added the object from the post document. Try clicking the comments connection and then remove the access_token and try and see the difference.
My site is using the Facebook comments box plugin. I can access the comments using the graph api for my iOS app by calling:
https://graph.facebook.com/comments?ids={url}
However, if the url referenced above isn't visited at least once in a browser I'll get the error:
{
error: {
type: "Exception",
message: "Unknown identifier, ",
}
}
It makes sense that the url hasn't been registered yet via the plugin. However, I might be accessing these urls in my iOS app before anyone visits them on the web. Does anyone know of a graph api call that will register the url with Facebook? If my situation were read only I would simply say there are no comments but I have the same problem when trying to post a comment.
You can programmatically scrape a particular page containing a social plugin by making a CURL (or similar) call to:
http://developers.facebook.com/tools/debug?url={YOUR_URL}&format=json
This is mentioned in the OG docs at http://developers.facebook.com/docs/opengraph/#edit although links to the older URL for the OG Linter.
I believe linting/scraping a page such as this should register any social plugins on the page without requiring you to visit the page first.
Edit: See also the Updating Objects section at the bottom of this doc: https://developers.facebook.com/docs/opengraph/objects/