I am trying to retrieve all comments of a certain user (not on a specific post but in a general way) using the Graph API.
I have come to understand that I need to query a user's posts and that the result will also contain that user's comments.
I manage to retrieve the list of posts for a specific user and I do see the comments the user posted.
However, the message property is always missing:
{
"id": "100005227004296_112167712300795",
"from": {
"name": "Karen Amebbgkdbif Lausen",
"id": "100005227004296"
},
"story": "\"Karens erster Kommentar zu...\" on Mike Amebkhdchid Letuchysky's photo.",
"story_tags": {
"35": [
{
"id": "100005200843894",
"name": "Mike Amebkhdchid Letuchysky",
"offset": 35,
"length": 27,
"type": "user"
}
]
},
"privacy": {
"value": ""
},
"type": "status",
"application": {
"name": "Photos",
"id": "2305272732"
},
"created_time": "2013-02-17T20:59:52+0000",
"updated_time": "2013-02-17T20:59:52+0000",
"comments": {
"count": 0
}
}
The story property contains a part of the message, but not all of it.
How can I access the full comment (text)?
Thanks in advance!
Alex
You may need to pull back additional properties such as type, status_type and description. If you like a link or comment on something else where and that appears in your timeline it can be returned from the post feed.
Try these fields in the graph API explorer to see what data is returned:
id,created_time,from,message,type,description,story,status_type
Related
When integrating a Facebook App with oauth.io, the latest API version we can choose is v2.3.
The login process works though, but, when trying to retrieve the user data (/me), only the elements name and id are being delivered in the raw data from the oauth.io response:
curl "https://oauth.io/auth/facebook/me"
-H “oauthio:k=<myOauthKey>&access_token=<fbAccessToken>"
we get following response:
{
"status": "success",
"data":
{
"id": "fbId",
"avatar": "https://graph.facebook.com/v2.3/fbId/picture",
"name": "User Name",
"gender": 1,
"url": "https://www.facebook.com/fbId",
"raw":
{
"name": "User Name",
"id": "fbId"
}
}
}
If we make the call directly using Facebook, I can get extra fields if I specify them in the URL:
curl "https://graph.facebook.com/v2.5/me?access_token=<fbAccessToken>
&fields=name,email,gender,birthday,first_name,last_name,picture"
we get the data we are looking for:
{
"name": "User Name",
"email": "email\u0040email.com",
"gender": "female",
"birthday": "03/02/1994",
"first_name": "User",
"last_name": "Name",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/hprofile-xlt1/v/t1.0-1/p50x50/whatever"
}
},
"id": "fbId"
}
The reason is clear: since v2.4 Facebook requires the fields parameter to retrieve the extra data. See Fewer default fields for faster performance under https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
Do you know if there is any way to tell oauth.io to fill the fields parameter when calling the facebook /me call?
Btw, using:
https://oauth.io/auth/facebook/me?fields=name,email,gender,birthday
does not work.
Oauth.io has fixed the issue and is available from 1.0.0-beta.18
https://github.com/oauth-io/oauthd/commit/7beec64ab39955c3afd2eb28ecf7288c74ccdc96
I'm working on an Android application and I'm trying to obtain contact pictures from friends. I'm still testing the graph request on the Facebook Graph API Explorer linkhere I'm going to use afterwards in the code, and I've hit a snag...
After generating an Access Token, and validating it allows me access to the correct fields I'm interested, I'm trying to filter the information I'm obtaining from Facebook.
Using the Facebook Graph API Explorer I'm performing the following request:
< USER_ID>?fields=id,first_name,last_name,location,picture,birthday,photos.limit(3).fields(id,picture,source,from)
I obtain, as expected:
{
"id": "<USER_ID>",
"first_name": "<FIRST>",
"last_name": "<LAST>",
"photos": {
"data": [
{
"id": "<PICTURE1>",
"source": "<PIC1.jpg>",
"from": {
"name": "<OTHER_USER1>",
"id": "<OTHER_USER1_ID>"
},
"created_time": "2013-08-17T11:39:19+0000"
},
{
"id": "<PICTURE2>",
"source": "<PIC2.jpg>",
"from": {
"name": "<OTHER_USER2>",
"id": "<OTHER_USER2_ID>"
},
"created_time": "2013-08-04T14:27:07+0000"
},
{
**"id": "<PICTURE3>"**,
"source": "<PIC3.jpg>",
"from": {
"name": "<USER>",
**"id": "<USER_ID>"**
},
"created_time": "2013-08-03T17:35:20+0000"
}
],
"paging": {
"previous": "<LINK1>",
"next": "<LINK2>"
}
},
"picture": {
"data": {
"url": "<PIC>",
"is_silhouette": false
}
}
}
What I would like is to only obtain the pictures from ... like the third picture or others, is this possible using the graph api?
Thanks for the help.
Marc
PS:
I've tried adding in the end something like &photos.data.from.id=< USER_ID>
but I till get the same data set in response.
I would like to avoid requesting more pictures and filter it programmatically, because You never know how many pictures are associated with a user that where not submitted by that user.
Not possible with the Graph API, but you can use FQL, to query for the photos of the user (not those in which he's tagged in) -
SELECT pid,src FROM photo WHERE owner = me()
Check FQL - Photo to include the required fields in the result.
Im using the Graph API to get certain data from my managed pages.
What i need is the likes, checkins and talking_about_count from my pages.
When i add checkins and talking_about_count i get an error that the API doesn't know the fields.
So i removed those and only asked for the likes and id.
What the API returns is a list with the posts from the page and only showing the id, creation date and the likes(if there are any).
I tested with some other fields like about and website, but they give the same error as checkins and talking_about_count, so i can't get basic data from my pages..
The link i use is this:
https://graph.facebook.com/168707433219493/feed?access_token=[Access_Token]&fields=id,likes,checkins,talking_about_count
And the error i get:
{
"error": {
"message": "(#100) Unknown fields: checkins,talking_about_count.",
"type": "OAuthException",
"code": 100
}
}
When i only ask for id and likes i get:
{
"data": [
{
"id": "168707433219493_333476503426186",
"created_time": "2012-11-28T19:38:57+0000"
},
{
"id": "168707433219493_370257573064477",
"created_time": "2012-11-22T08:12:11+0000"
},
{
"id": "168707433219493_423778884356339",
"likes": {
"data": [
{
"name": "Guido van Tricht",
"id": "1117357415"
}
],
"count": 1
},
"created_time": "2012-11-19T22:46:01+0000"
}
],
"paging": {
"previous": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&since=1354131537&__previous=1",
"next": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&until=1350819853"
}
}
I hope someone knows how to solve my problem, thanks in advance.
talking_about_count should be in the /PAGE_ID, not in the feed.
Why not get this data from:
https://graph.facebook.com/168707433219493?access_token=[Access_Token]
i am trying to retrieve a facebook POSTs information (ie: LIKE count) using the facebook API
The URL which used to work was in this format:
https://graph.facebook.com/?ids=[AUTHOR_ID]_[POST_ID]
(author and post ID omitted on purpose)
Now it returns a false data feed. Has the URL structure to retrieve POST information changed?
With October 2013 Breaking Changes, likes.count field is no longer available in the feed.
You need to make a call for each POST_ID with the summary field enabled.
https://graph.facebook.com/POST_ID/likes?summary=true&access_token=XXXXXXXXXXXX
There will be a "summary" element with a "total_count" field.
Nope, that still works for me - just tested with one of my posts:
"id": "<SNIP>",
//removed most fields
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/X/posts/Y"
},
{
"name": "Like",
"link": "https://www.facebook.com/X/posts/Y"
}
],
"type": "photo",
"status_type": "added_photos",
"object_id": "SNIP",
"application": {
"name": "Facebook for Android",
"namespace": "fbandroid",
"id": "350685531728"
},
"created_time": "2012-10-12T06:52:10+0000",
"updated_time": "2012-10-12T07:48:34+0000",
"likes": {
"data": [
// four likers' details
],
"count": 28
},
//snip
Check you still have read_stream Permission from your user, that the post hasn't been deleted, etc
I'm reading my user's friend's wall posts with the Graph API "/637674567/posts". One of the data items is that he likes a photo. Is there a way to get a URL for the photo? When I get the information about the item, I get the following (below). I've verified that Darryl allows apps to see his photos and status updates. I've tried getting every permission available for my app. I can't figure it out. Any help? Thanks!
{
"id": "637674567_10151119619094448",
"from": {
"name": "Darryl Green",
"id": "637674567"
},
"story": "Darryl Green likes a photo.",
"story_tags": {
"0": [
{
"id": 637674567,
"name": "Darryl Green",
"offset": 0,
"length": 19,
"type": "user"
}
]
},
"type": "status",
"application": {
"name": "Likes",
"id": "2409997254"
},
"created_time": "2012-08-29T03:29:03+0000",
"updated_time": "2012-08-29T03:29:03+0000",
"comments": {
"count": 0
}
}
Your friend might have enabled apps to access his photos. But there is another level of privacy setting, that is what kind of data can the apps his friend (you) use, be able to access from his feed ?
Chances are, if those settings don't allow for access to his photos when you are trying to access them via your app, you won't be able to do so.
For a more detailed explanation, please check this reply - http://facebook.stackoverflow.com/a/12151338/1628782.