Graph API only returns page posts - facebook-graph-api

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]

Related

Facebook Graph API Album Endpoint is deprecated?

I am using the graph api (through android SDK and graph explorer) to get a page's posts, when I get to a post of a page that has multiple images in a post it becomes an album.
Example post response
"message": "Test Multi-Photos",
"full_picture": "",
"from": {
"name": "TestPage",
"id": ""
},
"attachments": {
"data": [
{
"media_type": "album",
"media": {
"image": {
"height": 405,
"src": "",
"width": 720
}
},
"type": "album",
"title": "Photos from TestPage's post",
"target": {
"id": "147710857059579",
"url": ""
}
}
]
},
"id": "_147710857059579"
}
When I try to use the target.id to get the album photos
I believe the url would look like this
https://graph.facebook.com/147710857059579
I get a response saying that the endpoint is deprecated
{
"error": {
"message": "(#12) singular statuses API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12,
"fbtrace_id": "AhhiY7ohbb5SoXdFNDZnHhU
"
}
}
Documentation does not say anything about it being deprecated so how do you get the album photos?
To get photos from an album post you have to add subattachments to the attachments fields in the query.
Example using the Android SDK
parameters.putString("fields", "message,full_picture,from,place,attachments{media_type,media,type,title,description,target,subattachments}")
parameters.putString("limit", "10")

Facebook graph API obtain a specific users's pictures from that same user

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.

Message property missing from post object retrieved?

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

get Post like count with Facebook AP

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

How do I get the photo URL when reading a user's posts and they Like a photo?

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.