As we all know, facebook release the big updated on 30th April,2014. One of the changes log or alert is, FQL will not be available for the next version.
I tried and tried hard to replace and existing FQL using the graph API in order to get the same result. However, I failed.
One of the example goes like this:
SELECT src_big, caption, object_id, owner, images, created
FROM photo WHERE aid IN
(SELECT aid FROM album WHERE
owner IN (page_id1, page_id2, page_id3, page_id4)
AND type!='profile'
ORDER BY modified DESC)
AND created < 1398172643
ORDER BY created DESC
LIMIT 16
This example is to get some public photos from pages.
Anyone can tell me, how can I do that with Open Graph?
Related
Facebook's FQL was deprecated after v2.0. The website I'm working on previously had a "Recent photos" feature that populated recent photos using this FQL:
var fql = 'SELECT object_id, aid, images, album_object_id, created, modified, position, caption
FROM photo
WHERE aid in (SELECT aid, owner FROM album WHERE owner = me())
ORDER BY created DESC
LIMIT 59';
I'm trying to figure out a comparable way to do that using the graph api. the /photos endpoint is probably what I want, but I can't figure out if it has a valid order queryparam.
In postman I've been messing around with this:
https://graph.facebook.com/v2.2/10151316456544622/photos?fields=picture,name,source,created_time&limit=20&order=-created_time&debug=all&access_token=CAAL7TZAyo4RUBAOJe4Jgjdt6NZAqcajRghEGdKwraq4X1yZAKjvgXj4xXAZCoyZCkzMO84mTMJ90Vp5CEfJsT1WsoOwif2QZCS00bGqZAVxqmZChMUqKQmNsu2DvZCoY42ZC5fSBAxUuNCqTWg1QZCBZCz5oQx3wcNZCZCPUHOXMu5i5jZCOTGIiPWrAeTlzhFBqkvoZBZAPSJRhlkdxyrKPmpmOqgKrUeD13TdOtKU4ZD
The access_token is of a FB test account, feel free to go nuts. I'm not getting any debug information. There doesn't appear to be anything in the docs about how to change the order of photos.
This example url might not be the best. There's only 7ish public photos for this account, but I will potentially be getting recent photos from accounts with 1000s of photos. I don't want to just get all photos and reverse the list. I want to the most recent 20 photos in one call.
Any ideas? Is there order documentation that I've missed?
There is no direct way to achieve this using the Graph API, but you can use Real Time Updates to get notified about changes to the photos of a user.
I was using FQL to get all the photos in the user profile pictures album.
Since facebook decided to deprecate FQL in their latest version of graph api, im looking for the easiest and fastest way to get the user profile pictures (all of them)
I was using this FQL:
SELECT object_id, src_big, src_big_height FROM photo WHERE aid in (SELECT aid FROM album WHERE owner = 'XXXX' AND type = 'profile') LIMIT 20"
Any graph method that would get me the equivalent in 1 graph call? (I know i call call for /user/albums and to use the album id later to get the photos, but i don't want to seperate it to 2 calls)
Thanks alot
Ok, the best I could came up was using graph api field expansion:
https://graph.facebook.com/me?fields=albums.limit(1).fields(name,photos.fields(name,picture,source,images))
Im assuming the first album is the profile pictures.
Hope this can help others :)
I am using this query and trying to get share count of each pic but it returns an error.
SELECT link, comment_info, like_info, created, pid, src_big FROM photo WHERE aid
IN (SELECT aid FROM album WHERE owner=20531316728)ORDER BY share_count desc
I do want to order the last 20 pictures with there share count. Can somebody help me how could I achieve this.
I am not writing an application. Just testing it in Graph API explorer v2.0 API in developer tools.
This isn't possible because there exists no share_count field in the FQL photo table. https://developers.facebook.com/docs/reference/fql/photo/
I want to show the photos of an album in my app. Using the graph API i am able to filter and page by month, like below, which is great. I loop trough the results and get the photo for each id. Best of all, the GRAPH API also gives me a 'next' and 'previous' paging link. Very useful.
http://graph.facebook.com/[photo-album-id]/photos/?fields=id&limit=6&since=last month
But now i want to retrieve only those ids filter in two ways:
Only retrieve those in which the user is tagged
Only retrieve those in which the user & his/her friends are tagged.
I couldn't find any way to do this, with the graph API. Is there an alternative via FQL, that still has the paging in there?
Last alternative I can think of is program is in FQL, and do the paging myself.
p.s. I am doing this in Javascript currently.
You can retrieve photos the current user is tagged in in a specific album with this FQL call:
select object_id, src, album_object_id from photo where pid in (select pid from photo_tag where subject=me()) and and album_object_id=somenumber
To retrieve photos in which the user's friends are tagged, for a specific album:
select object_id, src, album_object_id from photo where pid in (select pid from photo_tag where subject in (select uid2 FROM friend WHERE uid1 = me())) and album_object_id=somenumber
As far as I know these results will not be paginated. For a detailed take on how to paginate fb queries see the Facebook Developer Blog: How-To: Paging with the Graph API and FQL
After a little play with the Graph Explorer (https://developers.facebook.com/tools/explorer/) I come up with this solution. You can make a call to Graph API as follows
/me?fields=friends.limit(5).fields(photos.limit(5))
The first limit is for how many friends you want to get and the second limit is how many photos you want from each friend.
At the end of the data there already is the next page URL.
I only tested on the explorer but should work.
Hope that helps,
Doruk
About a dozen users have complained that my app that fetches photos they are tagged in is not fetching the most recent photos... it is a simple call.
http://graph.facebook.com/me/photos
Is there any way to get the newest photos? Some sort of Order By? Or is there some kind of delay between tags and access via the API?
Any help would be appreciated!
I've seen some goofy stuff going on with the Open Graph API over the last week where objects that belong to a record are not getting returned with a valid API call. My issue went away on its own this weekend.
There is some delay in the best case between when an item gets tagged and it shows up on all the FB servers. The server that is serving your user's page to them will be different than the one serving the Graph API response. In my experience it is usually less than 30 mins, for the update but I've seen it take up to 6 hours.
As far as I can tell, you need to use an FQL call to explicitly order the results you get back.
You can get a list of photos with tags ordered by time by using this FQL query:
SELECT subject, object_id, created FROM photo_tag WHERE subject = USER_ID
where subject is the user id of the user who was tagged, object id is the id of the photo object, created is the creation time (as Unix timestamp), and photo_tag is the FQL table. This will return a list ordered by time with newest first.
From there, you can get the photo url using the object_id like this:
SELECT src, src_big, src_small FROM photo WHERE object_id = OBJECT_ID
which will give you urls to the photo in 3 differen sizes. This uses the FQL photo table.