Facebook Graph API Album Endpoint is deprecated? - facebook-graph-api

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")

Related

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.

list of Page Categories on facebook

I'm developing a facebook search and I would like to list all the page categories (is not relevant but I'm working with koala ruby gem):
A search with type="page" has results like these:
{"category"=>"Community", "name"=>"Koala", "id"=>"7356642860"}
{"category"=>"Product/service", "name"=>"Koala Groupe", "id"=>"188919981197745"}
{"category"=>"Public figure", "name"=>"Cushelle Koala", "id"=>"109202405786555"}
{"category"=>"Dancer", "name"=>"Koala Dance Bots", "id"=>"208563099183596"}
{"category"=>"Musician/band", "name"=>"Kid Koala", "id"=>"17527901121"}
{...}
I'm trying to develop a form to permit the user to achieve a a more precise search.
Then, I would like the user to have a list of categories, but: How to get the facebook pages categories list?
Use the following API to get list of page categories
FB.api(
'/fb_page_categories',
'GET',
{},
function(response) {
// Insert your code here
}
);
You will get response as
{
"data": [
{
"name": "Advertising/Marketing",
"fb_page_categories": [
{
"name": "Advertising Agency",
"id": "164886566892249"
},
{
"name": "Brand Agency",
"id": "1736039333278498"
},
{
"name": "Copywriting Service",
"id": "197029287003787"
},
{
"name": "Digital/Online Marketing Agency",
"id": "1751954525061797"
},
{
"name": "Internet Marketing Service",
"id": "1706730532910578"
},
{
"name": "Marketing Agency",
"id": "123377808095874"
},
{
"name": "Marketing Consultant",
"id": "170992992946914"
},
{
"name": "Media Agency",
"id": "281507032196735"
},
{
"name": "Public Relations Agency",
"id": "192021210817573"
},
{
"name": "Social Media Agency",
"id": "530553733821238"
},
{
"name": "Telemarketing Service",
"id": "197557456921449"
}
],
"id": "1757592557789532"
}
and so on....
There is a similar question here:
Authoritative List of all Facebook Subcategories
that I responded to. Hope this helps.
A standard Graph API call would be:
https://graph.facebook.com/v2.10/fb_page_categories?access_token={access_token_obfuscated}

Graph API only returns page posts

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]

How to get the cover photo of each facebook album using facebook android sdk

I am using facebook android sdk for accessing facebook albums. I've got the json that contains all the albums object. Want to get the cover photo of each album.
This is the object:
"id": "3486732467234",
"from": {
"name": "Persons Name",
"id": "Persons ID"
},
"name": "Vacation",
"location": "City",
"link": "https://www.facebook.com/album.php?fbid=434235&id=324343&aid=2430",
"cover_photo": "3489234432",
"privacy": "everyone",
"count": 60,
"type": "normal",
"created_time": "2007-06-03T23:01:16+0000",
"updated_time": "2011-03-18T19:46:43+0000",
"can_upload": true
}
How can i get the cover_photo image with this value "cover_photo": "3489234432" ??
I am able to get this value in a string..
Thanks
just request photo info by photoID, use this API:
https://graph.facebook.com/photoID
Don't forget the access_token

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