Facebook Graph API Comments not returning - facebook

I am trying to get the comments on ratings from the Facebook API.
First I request a list of ratings for a page I own:
https://graph.facebook.com/v3.0/me/ratings?fields=open_graph_story?access_token=[access_token]
Response:
{
"data": [
{
"open_graph_story": {
"message": "The best place in the world(s), and this is to reach that limit in the facebook review.",
"start_time": "2018-05-24T22:56:23+0000",
"type": "pages.rates",
"data": {
"rating": {
"value": 5,
"scale": 5
},
"review_text": "The best place in the world(s), and this is to reach that limit in the facebook review.",
"is_hidden": false,
"language": "en"
},
"id": "1805660589743235"
}
},
{
"open_graph_story": {
"message": "Very good, not excellent though. Does Facebook change the created time if I edit this?",
"start_time": "2018-04-12T20:25:26+0000",
"type": "pages.rates",
"data": {
"rating": {
"value": 3,
"scale": 5
},
"review_text": "Very good, not excellent though. Does Facebook change the created time if I edit this?",
"is_hidden": false,
"language": "en"
},
"id": "106674383523012"
}
}
],
"paging": {
"cursors": {
"before": "MTAwMDA4OTc5MzQ4Mjc3Ojc3MzQwNTI3NjIwMTQyNAZDZD",
"after": "MTAwMDI1NDEzNTE3NzgxOjc3MzQwNTI3NjIwMTQyNAZDZD"
}
}
}
(I removed some superfluous fields)
Then I use the id from the open_graph_story to get the comments for a rating:
https://graph.facebook.com/v3.0/106674383523012/comments?access_token=[access_token]
Response:
{
"data": [
],
"paging": {
"cursors": {
"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANVFF5T1RNeU1UUTVPRGszTWpNMU9qRTFNalkwT0RZAeE1qZAz0ZD",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZANVFE0TlRBM09URXlOamN5T1RreU9qRTFNamN5TURJek56ST0ZD"
}
}
}
It returns no data even though I can see comments on the actual rating when I visit the Facebook page. Why are no comments returned?
(Just to make sure that I had the correct permissions, I selected all the permissions possible in the graph api explorer.)

Related

Combining multiple facebook page reviews feeds in one call

How is it possible that I can add another access token to this call that references the second id I would like to retrieve reviews from.
In all other instances like posts, photos etc this would work but because you are required to have a page access token to retrieve the data for reviews I'm not sure how to construct the url to make the call. Is it possible?
https://graph.facebook.com/ratings?ids=slickremix,reformavi&field=rating&limit=5&access_token=EAAP9hArvboQBAN5...
That call returns something like this, as you can see the second id reformavi is not returning data.
{
"slickremix": {
"data": [
{
"created_time": "2016-10-13T09:22:02+0000",
"reviewer": {
"name": "Jens Kranen",
"id": "10211267740634296"
},
"rating": 5,
"review_text": "Fantastic customer support. Very quick response. Spencer could identify the problem within minutes and gave great advice.\nThank you"
},
{
"created_time": "2016-10-07T14:22:19+0000",
"reviewer": {
"name": "Marc McHale",
"id": "10157614348555341"
}
"rating": 5,
"review_text": "I purchased the Facebook Reviews plugin for a client website and both my client and I are very happy with the appearance and functionality! Plus, the customer service was outstanding!"
}
],
"paging": {
"cursors": {
"before": "MTM4MjkwMTM4ODoxMTg3OTA3NTE1MjU4ODQZD",
"after": "MTI1MTQ3Njk2NToxMTg3OTA3NTE1MjU4ODQZD"
},
"next": "https://graph.facebook.com/v2.7/118790751525884/ratings?access_token=EAAP9hArvboQBAN5HpnbA5m87qC7poAAqB0YS47zxBCBmCfVRcqCC7zX1XDNCv6cSe3KFnMtPVysUms0MuXLxWfv8D9McMwzvD2HWWd0IO6FOZC6ogvcta8FWZBR0vUA9HCZAdqdB53fyUB26XLb76ORLspiPg3Hzb4Pn5RTjwZDZD&pretty=1&limit=5&after=MTI1MTQ3Njk2NToxMTg3OTA3NTE1MjU4ODQZD"
}
},
"reformavi": {
"data": [
]
}
}

page-id/notifications returns an empty array

I'm writing a desktop application using Facebook SDK .NET. This app must do somethink for every post, comment or message sent to a Facebook page. I'm using the page-id/notifications API command:
page-id/notifications?fields=id,title,unread,application,from,message,object&limit=250
This command returns correct unseen count in summary section but data array is empty:
{
"data": [
],
"summary": {
"unseen_count": 2,
"updated_time": "2016-02-05T14:53:10+0000"
}
}
If someone write a new wall post on the page or send a private message to the page, unseen_count is updated but data array is always empty. If someoune write a comment to an exisiting wall post unseen_count is updates and data array is populated with a comment notification (only this type of notification are added to data array):
{
"data": [
{
"id": "notif_XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXX",
"title": "yyyyy yyyyyyy commented on his post.",
"unread": 1,
"application": {
"link": "https://www.facebook.com/games/?app_id=xxxxxxxxxxx",
"name": "Feed Comments",
"id": "1967xxxxxxx"
},
"from": {
"name": "Mxxxx Sxxxxxx",
"id": "1020xxxxxxxxxxxxx"
},
"object": {
"created_time": "2016-02-05T14:52:32+0000",
"message": "ABCDEFGHILMNOPQRSTUVZ",
"id": "36xxxxxxxxxxxx0_546xxxxxxxxxxx0"
},
"to": {
"name": "Ixxxxxxx",
"id": "36xxxxxxxxxxxxx"
}
}
],
"paging": {
"previous": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"next": "xxxxxxxxxxxxxxxxxxxx
},
"summary": {
"unseen_count": 3,
"updated_time": "2016-02-05T14:55:23+0000"
}
}
Is it an API bug or there is something wrong in my API request?
I CANNOT use real time notification.
Thanks
Marco

Getting high res photos from Facebook News Feed API

I am trying to get a high resolution photo from the post below in my news feed. I tried calling https://graph.facebook.com/v2.1/10154603506630195 using the object_id based on advice here (getting high resolution photos that were posted on a page wall/feed) but it doesn't seem to work, any help would be much appreciated :)
{
"id": "10154603665915195_10154603509055195",
"from": {
"id": "10154603665915195",
"name": "John Smith"
},
"message": "I've taken up queuing as a new hobby during my short time in England. Here we are outside a store that won't open for another half hour...",
"picture": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/s130x130/10699259_10154603507605195_419931109_n.jpg?oh=ff3ec0e772fea164bbd9d61e9ee9a4d0&oe=540E80D2&__gda__=1410242521_d3b2dc1c8f971610b07e0408cd62815b",
"link": "https://www.facebook.com/photo.php?fbid=10154603506630195&set=a.10150303996795195.555860.698310194&type=1&relevant_count=1",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
},
{
"name": "Like",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
}
],
"privacy": {
"value": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "10154603506630195",
"application": {
"name": "Facebook for iPhone",
"namespace": "fbiphone",
"id": "6628568379"
},
"created_time": "2014-09-07T10:40:03+0000",
"updated_time": "2014-09-07T10:40:03+0000",
"likes": {
"data": [
{
"id": "711243852300920",
"name": "Megumi Yoshida Atobe"
},
{
"id": "10152707756462594",
"name": "Emily Stokes-Rees"
},
{
"id": "10152741507272044",
"name": "Lina Kumamaru Sato"
}
],
"paging": {
"cursors": {
"after": "MTAxNTI3NDE1MDcyNzIwNDQ=",
"before": "NzExMjQzODUyMzAwOTIw"
}
}
}
}
If you are using the FB Graph API, ask for the full_picture field in your request:
FB.api('10153224297552834_10153268631032834?fields=full_picture', function (response) {
console.log(response.full_picture);
});
Try specifying the attachments field in your request.
/v2.2/<someId>/feed?fields=attachments
This will give you an 'attachments' field, with some media inside. You'll find there high res images.

How to get picture of user who has commented on my facebook post?

I have post_id of the status which user share by iOS app, Now with graph api, I'm getting comment info and like info:
POST_ID?fields=likes.fields(pic_square,name),comments
With above, I'm able to fetch most of the details, but not profile pic of user who commented on post. check details which I'm getting:-
{
"id": "POST_ID",
"updated_time": "2014-03-25T07:07:14+0000",
"likes": {
"data": [
{
"pic_square": "https://fbcdn-profile-a.akamaihd.net/static- ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif",
"name": "User name",
"id": "100007640XXXXX"
}
],
"paging": {
"cursors": {
"after": "MTAwMDA3NjQwMzcxMzQxxx",
"before": "MTAwMDA3NjQwMzcxMzQxxx"
}
}
},
"comments": {
"data": [
{
"id": "2069772628xxxxxx",
"from": {
"name": "user name",
"id": "100007640xxxxxx"
},
"message": "great reader..",
"can_remove": true,
"created_time": "2014-03-26T06:19:36+0000",
"like_count": 0,
"user_likes": false
}
],
"paging": {
"cursors": {
"after": "MQ==",
"before": "MQ=="
}
}
}
}
Now I need picture of a user who commented on post, I'm getting picture of user who likes, but not who commented. I tried to get it with FQL but not succeed.
Here in response you are getting user id who had liked your post so use that as follows
https://graph.facebook.com/10000445993xxxxx/picture?type=large
Use this API:
https://graph.facebook.com/100007640xxxxxx/picture
100007640xxxxxx: is userid.
Edit:
if you want to load user picture in particular size then you can use following:
https://graph.facebook.com/100007640xxxxxx/picture?width=150&height=150

Getting Likes count of each posts on a fan page in Facebook

How do I get the 'like' count of a post on Facebook?
I got a link graph.facebook.com/userid_postid that says says I can do this. But How do I find the user or page ID and the ID of the post?
For example, if take any post on the fan page:
http://www.facebook.com/TipsLearnings of site http://adityabajaj.com
If I make a post on the fan page above, and people like the post, how would I get the number of likes of that post? I want to have that number available to show on a separate website.
You can use FQL
SELECT like_info.like_count, share_info.share_count, comment_info.comment_count FROM stream WHERE post_id = 'your_post_id'
You can get a list of most recent posts a fan page made by using /<PAGE_ID>/posts (which you can find for your page by navigating to http://graph.facebook.com/myown.easytipsandtricks, or just use the username) with a valid access token. From that, you get an object that looks like this:
"data": [
{
"id": "22092443056_115909438544849",
"from": {
"name": "Starbucks",
"category": "Food/beverages",
"id": "22092443056"
},
// ...
"shares": {
"count": 708
},
"likes": {
"data": [
{
"name": "Shanna Gonzales",
"id": "100000244536406"
}
],
"count": 17129
},
"comments": {
"count": 759
}
}
// ... and more posts
Accessing the count subfield of each of those fields should tell you shares, likes and comments, respectively.
You can get the comments/likes count without having to paginate by using the fields parameter in combination with likes.limit(1).summary(true). For example, a search api query for pizza below will give you all public posts and their likes count summarized:
https://graph.facebook.com/search?q=pizza&type=post&fields=id,name,likes.limit(1).summary(true)
results (truncated):
{
"data": [
{
"id": "47883936273_659693910762305",
"name": "Instagram",
"created_time": "2014-02-16T01:15:29+0000",
"likes": {
"data": [
{
"id": "100002243084532",
"name": "Yvette Martin"
}
],
"paging": {
"cursors": {
"after": "MTAwMDAyMjQzMDg0NTMy",
"before": "MTAwMDAyMjQzMDg0NTMy"
},
"next": "https://graph.facebook.com/47883936273_659693910762305/likes?limit=1&summary=1&after=MTAwMDAyMjQzMDg0NTMy"
},
"summary": {
"total_count": 13682
}
}
},
{
"id": "136336876521150_314001148754721",
"name": "Pizza Box Turns into Plates & Storage Unit!",
"created_time": "2014-02-15T21:20:00+0000",
"likes": {
"data": [
{
"id": "100005373008864",
"name": "Liliana Campoli"
}
],
"paging": {
"cursors": {
"after": "MTAwMDA1MzczMDA4ODY0",
"before": "MTAwMDA1MzczMDA4ODY0"
},
"next": "https://graph.facebook.com/136336876521150_314001148754721/likes?limit=1&summary=1&after=MTAwMDA1MzczMDA4ODY0"
},
"summary": {
"total_count": 2792
}
}
}