I am trying to FQL query comments, made by my on photo's my friends were tagged in.
SELECT text FROM comment WHERE object_id IN ( SELECT object_id FROM photo_tag WHERE
subject IN (SELECT uid1 FROM friend WHERE uid2 = me()) ) AND fromid=me() LIMIT 1000
The query in it self works fine on the Graph API Explorer. When i am on the Graph API Explorer, and then choose my app to run the query the result comes up empty, were the Graph API App returns results.
Any ideas on this? I have noted that other people have had this issue. But there seems to be no fix for it? I am wondering if people just gave up. Because i have also been at it for a while without any solutions.
I will limit the query, so it dosen't look back more than 3 months, but for now it's not so i am sure i get some data.
So, we found the issue ourselves, while the Graph API Explorer (the tool) follows the documentation that facebook provides, your own implementation does not. So it's consistently different, so we were able to make it work knowing this, so with what should actually be an bug we made it work.
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'm trying to find which of my friends have been to Paris before. I'm trying to use the Graph API to do this.
So basically there's the place id (for Paris it's 110774245616525), I can get basic informations using the endpoint https://graph.facebook.com/110774245616525/ to do this. Then, I'm getting an access_token with friends_status and user_status permissions (using the Graph Explorer) and I'm using this access token to get the checkins. So I'm doing a GET https://graph.facebook.com/110774245616525/checkins?access_token=my_access_token call and all I get is this error message :
page_id is not a member of the checkin table
Although, reading the documentation I see the connection with checkins :
Checkins made to this Place Page by the current user, and friends of
the current user.
Is this an error with the Graph API or with the way I do it?
Thanks !
There's a breaking change for checkins in the July release https://developers.facebook.com/roadmap/ it mentions renaming page_id to target_id so this might be what's causing it. However the following fql query might be a starting point for you
select author_uid from checkin where target_id = 110774245616525
author_uid should be the person who checked in https://developers.facebook.com/docs/reference/fql/checkin
I got the following fql to work to display all the names of my friends who have checked in at a specific location. Only tried it in Graph API Explorer, and it was fairly slow :/ Let me know if it's helpful :)
Select name from user where uid in (Select author_uid from checkin where author_uid in (select uid2 from friend where uid1=me()) and target_id=110774245616525)
An additional note: I noticed that many of my friends show up in the "Friends who have visited Paris, France" box, but they don't have any actual checkins there. I think that the box also checks to see if your friends have any photos from paris.. Just a thought
With the help of asifrc and TommyBs I found a way to do this in FQL using this query :
SELECT name
FROM user
WHERE uid IN (
SELECT author_uid
FROM location_post
WHERE distance(latitude, longitude, "48.856614", "2.3522219") < 5000
AND author_uid IN (SELECT uid2 FROM friend WHERE uid1=me()))
It's pretty much getting all my friends, searching all their posts close to the center of Paris, then getting their names.
If anyone knows how to do this in Graph API, please let me know, because it's still not a good idea to rely on FQL, I think.
I'm trying to get the pages that my friends like using this FQL multiquery:
{
"query1": "SELECT uid2 FROM friend WHERE uid1 = me()",
"query2": "SELECT uid, page_id, type FROM page_fan WHERE uid IN (SELECT uid2 FROM #query1)",
"query3": "SELECT page_id, name, categories, type, page_url, pic_big FROM page WHERE page_id IN (SELECT page_id FROM #query2)"
}
The query works fine and returns results. However, it returns around 2940 pages for 260 people, which is way less than the sum of the actual like count for the people queried.
I considered it could be a permission problem and asked for one of the people on this list to remove "access likes, interests..." permissions for friends' applications. On the next run, her pages and likes weren't on the JSON returned, but the page count actually increased some 10 or 20 records.
Am I doing something wrong here? I'm using multiquery for performance reasons.
This occurs both using the Graph API explorer and the PHP SDK:
$fql = urlencode($fqlQuery);
$response = $facebook->api("/fql?q={$fql}");
Any thoughts on this problem?
Thanks in advance :)
There is an additional privacy feature on Facebook that might be limiting the results you receive from certain people.
The setting is in the privacy settings and its called - How people bring your info to apps they use
It also gives a short description -
People who can see your info can bring it with them when they use apps. Use this setting to control the categories of information people can bring with them.
One of the options within that settings is "Activities, interests, things I like". For my profile this option is set to off. So no matter what permissions an application gets from a friend of mine, that application will not be able to see my "Likes".
My suspicion is that some of your (wiser) users have this setting disabled as I do, and it is preventing your application from getting to that information.
As an aside, I think this setting is crucial for real privacy on a Social Network. Just because my friends can see what pages I like, doesn't mean I want any application they use to also be able to see that info.
I've been scouring the docs for a while now and can't seem to find a way to accomplish this. The information is available publicly (on a facebook page ... the link says "View all # shares") but I can't seem to find a way to access this info either via FQL or the graph API.
I know I can get a list of likes for a given post:
https://graph.facebook.com/87236249496_134765166623967/likes
The goal is to get a list of people who've shared -- but there doesn't seem to be the same sort of thing for shares. Am I missing something?
You can do it via "graph.facebook.com/OBJECT_ID/sharedposts" connection:
I figure it out this connection via metadata=1 parameter:
Go to... http://www.facebook.com/ajax/shares/view/?target_fbid=10154612868272801&__a=1
10154612868272801 is Facebook story ID, __a stands for asynchronous.
You will see large amount of text/JSON, it is basically HTML & JS for little popup window. There is portion of text like hovercard.php?id=# where # is Facebook user ID, using preg_match_all you then get all of the user ID's who shared that post.
Eg: 100000541151971 (Eric) and 9204448 (Courtney)...
Unfortunately, you must be logged into Facebook to do first step, figure it out :)
I think you can get the share_count from stream table by FQL query just like
SELECT type, source_id, share_count, permalink, description, post_id, actor_id, target_id, message , share_count
FROM stream
WHERE filter_key = 'others' and post_id = '87236249496_134765166623967'
you can test it https://developers.facebook.com/tools/explorer/
Note: you have to take the read_stream permissions as explained here
Tye this link: https://graph.facebook.com/134765166623967/sharedposts (with a valid access_token)
The id in the link is the wallpost id (87236249496_134765166623967) minus the page id (87236249496) and minus the underscore.
You'll also need the read_stream permission
I know you're looking to get at shares through the post_id, but can you settle for finding shares by page_id instead of post_id?
If you can, then you can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the post author in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that query might get you what you want.
Is there anyway to get a list of mutual friends using Facebook's Graph API?
I've been playing around with this tool and haven't yet figured out a way. However, I saw Simon's demo on Facebook's site, and it sounded like he was able to get the mutual likes of friend of his (it was too blurry to see how he did it so) so I feel like I ought to be able to, but I can't find any documentation besides some php scripts.
The Mutual Friends API was deprecated on April 4, 2018, and the endpoints below started returning empty data sets. The endpoints are now fully deprecated and will return an error. https://developers.facebook.com/docs/graph-api/changelog/version3.1#mutual-friends-api
You can use this one to get mutuals friends from the graph
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fmutualfriends%2F1207059
Goto the API Documentation page here:
http://developers.facebook.com/docs/reference/api/
Mid-way down the page you will see:
•Friends: https://graph.facebook.com/me/friends?access_token=...
You'll need to replace the /me/ with a valid ID of the person you are looking for and you;ll need to get the access_token as well.
Hope this starts you in the right direction..
EDIT: There is also this which may be easier:
http://developers.facebook.com/docs/reference/rest/friends.getMutualFriends/
Legacy REST method
I would do this as a FQL query and test it with their FQL tester. This might not be 100% what you are looking for, but it should be enough to get you started:
SELECT uid1, uid2 FROM friend
WHERE uid1 IN
(SELECT uid2 FROM friend WHERE uid1=me())
AND uid2 IN
(SELECT uid2 FROM friend WHERE uid1=me())
You could then look up these id's up against the user table.