Facebook just notified me about "July 2013 Breaking Changes". There is one related to my app.
Deprecating 'comments' field from 'stream' FQL table
We are deprecating the 'comments' field from 'stream' FQL table. Please select the 'comment_info' column to fetch the 'can_comment' and 'comment_count' fields (formerly called 'can_post' and 'count'), and use the comment table directly to retrieve the list of comments.
In our app we are using query like this :
SELECT post_id, message, likes.count, comments.count, comments.comment_list FROM stream
WHERE source_id=me() AND actor_id=me() LIMIT 500
and receive response like this :
{
"data": [
{
**"post_id": "100002510712421_451594341600919",**
"message": "text",
"likes": {
"count": 1
},
"comments": {
"count": 2,
"comment_list": [
{
"fromid": 100001228089363,
"time": 1367073822,
"text": "text",
"text_tags": [
],
"id": "100002510712421_451594341600919_1181882",
"likes": 0,
"user_likes": false,
"post_fbid": 452073094886377
},
{
"fromid": 100000020227797,
"time": 1367173047,
"text": "text",
"text_tags": [
],
"id": "100002510712421_451594341600919_1183852",
"likes": 0,
"user_likes": false,
"post_fbid": 452790081481345
}
]
}
},
....
ok now try to fetch info from 'comment' table using given post_id
SELECT id, text, time, fromid FROM comment WHERE
post_id='100002510712421_451594341600919'
{
"data": [
]
}
The response is empty
Can anybody come up with solution? We really need it!
your query looks just fine, are you sure that this post_id exists and you have permission to read it?
SELECT id, text, time, fromid FROM comment WHERE
post_id='125909647492772_502974003098530'
returns
{
"data": [
{
"id": "502974003098530_78616446",
"text": "saugeil!",
"time": 1364309881,
"fromid": 526559276
}
]
}
I'veI run into the same issue.
Surprisingly, I was able to fix it by using only last part of the post_id, i.e.: '451594341600919' instead of '100002510712421_451594341600919'. But it works only sometimes and in your case doesn't work at all.
Related
I am trying to pull the photos from a user's post within a group. Posts in a group seem to be either created as a 'photo' or 'status'.
I am able to pull the photos from a post within the group when it is created as a 'photo' using this:
SELECT attachment FROM stream WHERE post_id="<postid>"
But if the post was created as a 'status' this query doesn't return any data for the attachment.
Here is an example of a post created as a 'status' and what the results are. No data for attachment (photo) when I know there is a photo that goes with that post.
SELECT attachment, type, message, created_time FROM stream WHERE post_id = '<postid>'
{
"data": [
{
"attachment": {
"description": ""
},
"type": 308,
"message": "Ceramic wall hanging with mirror from Spain (6\"x8\") $5 pickup in SR",
"created_time": 1379101402
}
]
}
Is this a permissions thing or am I just not pulling from the correct table(s) for this type of post?
Thanks
Chris
Just saying that it works fine for me:
SELECT post_id, attachment, type, message, created_time FROM stream WHERE post_id="POST_ID"
POST_ID looking like: 481234567779150_559912345679366. The permissions I use are user_groups and user_friends.
{
"data": [
{
"post_id": "481234567779150_559912345679366",
"attachment": {
"media": [
{
"href": "https://www.facebook.com/photo.php?fbid=10123450&set=gm.5599123456789366&type=1&relevant_count=1",
"alt": "bla bla bla",
"type": "photo",
"src": "https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn1/1013188_102013456789034740_1177097408_s.jpg",
"photo": {
"aid": "65904234567838363",
"pid": "65904345678990795",
"fbid": "10202345678934740",
"owner": 1533245678910,
"index": 1,
"width": 1032,
"height": 581,
"images": [
{
"src": "https://fbcdn-photos-f-a.akamaihd.net/hphotos-ak-prn1/1013188_10123456789_1177097408_s.jpg",
"width": 130,
"height": 73
}
]
}
}
],
"name": "",
"caption": "",
"description": "",
"properties": [
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"fb_object_type": "photo",
"fb_object_id": "65123456789090795"
},
"type": 308,
"message": "bla bla bla",
"created_time": 1373368884
}
]
}
Did you try your query in the Graph API Explorer? Can you give more information? What kind of group is it, secret, public? Is the user one of your friend? I personally tried with both public or private groups and friend or non-friend posts. Can you confirm this happens with other 308-type posts with a photo and on several groups?
we are using the facebook timeline phtot stream, to show the last photos on the website.
We are parsing the url: http://graph.facebook.com/132827113407662/photos
If you have a look at the 5th pic, it shows 25 likes.
If you look at this pic on fb (https://www.facebook.com/photo.php?fbid=635486689808366&set=a.132827113407662.19448.114902408533466&type=1), it shows 31 "Likes".
How can I get the correct number of "likes".
It seems, that the largest number in the stream (http://graph.facebook.com/132827113407662/photos) ist 25. Any like higher than 25 will be ignored in the stream.
Why?
Likes collection is paginated. You can read more about pagination here.
Looks like there is still no way to get all rows count for a collection using graph api request.
But you can get it through FQL.
select like_info, object_id from photo where album_object_id = 132827113407662
Returns:
{
"data": [
...
{
"like_info": {
"can_like": true,
"like_count": 31,
"user_likes": false
},
"object_id": 635486689808366
},
...
]
}
Using the Graph Api you can request fields summary like this: ?fields=likes.limit(1).summary(1)
And the page/album/photo likes are contained in the summary.total_count object.
http://graph.facebook.com/132827113407662/photos?fields=likes.limit(1).summary(1)
This will give you as follows:
{
"data": [
{
"id": "690240794332955",
"created_time": "2013-10-31T18:11:07+0000",
"likes": {
"data": [
{
"id": "100003293421476",
"name": "Rene Geels"
}
],
"paging": {
"cursors": {
"after": "MTAwMDAzMjkzNDIxNDc2",
"before": "MTAwMDAzMjkzNDIxNDc2"
},
"next": "http://graph.facebook.com/690240794332955/likes?summary=1&limit=1&after=MTAwMDAzMjkzNDIxNDc2"
},
"summary": {
"total_count": 78
}
}
}
]
}
seems Facebook changed the result of posts, few weeks ago it was possible to read the comment count from the post directly
https://graph.facebook.com/125909647492772_502974003098530
you got something like
...
"comments": {
"data": [
{
"id": "502974003098530_78616446",
"from": {
"name": "Mathias Fritz",
"id": "526559276"
},
"message": "saugeil!",
"can_remove": false,
"created_time": "2013-03-26T14:58:01+0000",
"like_count": 1,
"user_likes": false
}
],
"paging": {
"cursors": {
"after": "MQ==",
"before": "MQ=="
}
},
"count": 1
but now the count is missing.
I did some research on the graph documentation but the only change in that direction seems to be that comments can have comments now... and those comments are counted in a field named comment_count.
Is there still a way to get the total comment count?
To get the count, add ?summary=1 at the end: https://graph.facebook.com/125909647492772_502974003098530/comments?summary=1
I was having same problem, just adding likes.summary(true),comments.summary(true) in parameter in against "fields" worked for me.
e.g. I used https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN&fields=story,from,story_tags,likes.summary(true),comments.summary(true)
instead of https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN
Also you can add other parameters if you want; separated by a ,
summary=true is what you are looking for
Get likes count :
114916098537132_1265715836790480/likes?summary=true
Get comments count
114916098537132_1265715836790480/comments?summary=true
Get shares count :
114916098537132_1265715836790480?fields=shares
And last [ combining all 3 ]
114916098537132_1265715836790480?fields=shares,likes.summary(true),comments.summary(true)
Improved version ( add limit(0) to removes list of likes and get only summary ):
114916098537132_1265715836790480?fields=shares,likes.limit(0).summary(true),comments.limit(0).summary(true)
This works perfectly with me:
fields=shares,created_time,comments.summary(true).limit(0)
This return comments count at summary and return 0 comments at the same time which is perfect as you only need the comment count.
You can get total comment count via FQL. See this question below as reference:
Facebook API - comment count via FQL
Here's the query you need: SELECT comment_info FROM stream WHERE post_id = ...
If you'd like to count everything on Facebook.
(That number is visible for Facebook's User)
You should use FQL (Facebook Query Language) instead of Graph API.
Facebook Query Language Reference
This situation you should to query
SELECT comment_info FROM stream WHERE post_id = ...
You can do such requests:
{pageid}/posts?fields=comments.summary(1){id}
It will return a list of posts including comments count of each post.
Here I have returned only the comment id because I only need the number of comments per post, but of course you can include many other fields:
{pageid}/posts?fields=comments.summary(1){id,message},id
Or to make less changes to you excisting code, use:
$.each(json.data,function(i,fb){
...
var commentsCount = 0
if(fb.comments!=undefined){
commentsCount=fb.comments.data.length
}
...
}
commentsCount holds number of comments for active child
Try the following:
{
"data": [
{
"id": "447235535389660_1226199",
"from": {
"name": "Harjeet Walia",
"id": "100004980601083"
},
"message": "Price",
"can_remove": false,
"created_time": "2013-09-06T10:39:01+0000",
"like_count": 0,
"user_likes": false
},
{
"id": "447235535389660_1226152",
"from": {
"name": "Shoba Dhyani Jakhmola",
"id": "100000906896060"
},
"message": "baap re kitna mehnga !",
"can_remove": false,
"created_time": "2013-09-06T10:05:09+0000",
"like_count": 0,
"user_likes": false
}
],
"paging": {
"cursors": {
"after": "MQ==",
"before": "NA=="
}
}
}
then
int commentCount = <JsonNode Var with above data>.path("comments").path("data").size();
Here commentCount will give the number of comments.
Facebook realtime docs specify that the callback data is of the following format
{
"object": "user",
"entry": [
{
"uid": 1335845740,
"changed_fields": [
"name",
"picture"
],
"time": 232323
}, {
"uid": 1234,
"changed_fields": [
"friends"
],
"time": 232325
}]}
If two different objects, say 'user' and 'page' are to be sent back, does facebook
Batch them together?
Send them separately?
Different objects are sent in different requests. But if there are many user requests then it will batch those user requests and send it. And also you can have different end points for user and page. The format of page request is also different.
It looks something like this
{
"object": "page",
"entry": [
{
"id": "408518775908252",
"time": 1360643280,
"changes": [
{
"field": "feed",
"value": {
"item": "like",
"verb": "add",
"user_id": 5900878
}
}
]
}
]
}
In facebook graph search, type=post
https://graph.facebook.com/search?q=watermelon&type=post&token=XXXXXXXXX
It return data:
{
"data": [
{
"id": "100001477475394_211188005607114",
"from": {
"name": "Jerry Garcia",
"id": "100001477475394"
},
"message": "I like watermelon,fried chicken and koolaid !\nWhat does that make me ? lol",
"type": "status",
"created_time": "2011-09-07T21:33:28+0000",
"updated_time": "2011-09-07T21:33:58+0000",
"likes": {
"data": [
{
"name": "Natalie Hurtado",
"id": "100002486021428"
}
],
"count": 1
}
}
]
}
So how to get this post's comment? (fql also welcome)
and what is the {data->id} (100001477475394_211188005607114), I tried fql.steam query nothing return, so it is not a post_id. how can I get this post id?
Thanks.
add &fields=comments(,other fields)
or make another call to the graph using id/comments
for detail see http://developers.facebook.com/docs/reference/api/post/
look for comments