So i'm trying to get friends check ins form a specific date up to "now"
Like so:
search?type=checkin&since=1343613333633
(1343613333633 = 30 Jul 2012 01:55:33 GMT)
And I always get {"data":[]}
with out the "since" param i some check ins (all of them after that date)
i get the same results both on graph api explorer and from Android Facebook SDK (not sure if this is important)
How do i fix this?
Thx in advance.
You can easily use FQL to do it:
SELECT coords, tagged_uids, page_id, timestamp FROM checkin WHERE author_uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) and timestamp > 1312971542
will give you the list of friend checkins of the current logged in user since timestamp. Be sure to have the friends_checkins permission when retrieving the access token.
Related
I am using Facebook FQL to query stream table. I want to get the list of all user ids of friends who liked one of my post. Here is my query:
select post_id,likes.friends, likes.count from stream where source_id = me() and likes.count > 0 limit 200"
However, I only get maximum 4 friend ids in return, even if likes.count > 4, which is exactly like likes.sample.
Is this a bug, or a limitation of FQL? If I can't get full list of Likers here, which table I should look at? If this is not feasible with FQL, how can I make a similar query in Graph API?
Thank you.
Use a multi-query on the stream and like tables
{"posts": "select post_id, likes.count from stream where source_id = me() and likes.count > 0 limit 200",
"friends_who_like_posts":"select user_id FROM like WHERE post_id IN (SELECT post_id FROM #posts) AND user_id IN (SELECT uid2 FROM friend WHERE uid1 = me() )"
}
Is there a way to append my long term access token to the query given at Getting Facebook Events using fql ? The query at that link is
fql?q={"event_info":"SELECT name,description, pic_small,pic_big, eid,venue,location from event WHERE eid in (SELECT eid FROM event_member WHERE uid = me())", "event_venue":"SELECT name, username, page_id, location FROM page WHERE page_id IN (SELECT venue.id FROM #event_info)"}
Thanks in advance for any assistance...
UPDATE - The answer provided worked like a charm. THANK YOU!
Yes. Try this:
/fql?q=QUERY&access_token=TOKEN
I am trying to get all posts near specific location. I post some statuces and photos on my FB page with location.
In Graph API Explorer I run this query:
SELECT id, coords, type, page_id, timestamp FROM location_post WHERE author_uid = me()
and it results in right way, but when I add:
SELECT id, coords, type, page_id, timestamp FROM location_post WHERE author_uid = me() AND distance(latitude, longitude, '47', '122') < 10000
then all results cleared.
I tried to get distance in query and it results in nice numbers like 33 or 454. So why distance function in WHERE section results in nothing?
Also request from example:
SELECT id, page_id
FROM location_post
WHERE distance(latitude, longitude, '37.86564', '-122.25061') < 10000
does't show anything.
For the example query, Your lat/long is reported somewhere outside of Oakland, CA. To return data you need one of the following:
If you requested user_location permission in your access token, you need to have made or been tagged in a post made within 10km (~6.25 mi) of this point.
If you requested friends_location permission in your access token, a friend of yours needs to have made this post.
I am running the following FQL via the php sdk:
{
"posts" : "SELECT post_id, actor_id, message, type FROM stream WHERE type = '80' AND message != '' AND filter_key in (SELECT filter_key FROM stream_filter WHERE uid='588853265' AND type='newsfeed') AND is_hidden = 0 ORDER BY created_time DESC LIMIT 50",
"actors" : "SELECT uid,name FROM user WHERE uid IN (SELECT actor_id FROM #posts)",
"links" : "SELECT owner, url FROM link WHERE link_id IN (SELECT post_id FROM #posts)"
}
I get results as expected for posts and for actors but not for links (results are empty). I believe the problem is that the link table uses a normal ID but my 'posts' from 'stream' show the ID in the format: USERID_LINKID.
I have played around with substr() and strlen() to get it to work with no luck.
There doesn't seem to be a way to get a link_id from a stream post. Your query is getting the id of the post, but not the link.
However, I don't think you need it. Get rid of the #links sub-query and add attachment to the SELECT statement in your #posts sub-query. You can get the link url at attachment->media->url.
One other critique: You might want to add additional sub-queries for #actors. The actor_id returned by the stream table can be a user, page, or group. Your FQL only resolves users. You'll end up with unknown IDs for links posted by groups and pages.
I have to fetch all data which is on News Feeds (public wall). What query should I write ?
I wrote "SELECT likes,message FROM stream WHERE source_id = %lld limit 50 " query but it is returning my wall value. I want to fetch all data which is on my wall as well as on public (News Feed).
Thanks in advance
You need to use the filter_key to select the type of feed to use. The type you are after would probably be newsfeed, so the query could be something like this:
SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid = me() AND type = 'newsfeed')
For more information, have a look at the stream_filter docs.
How about doing it without querying FQL? :)
Use the Graph API instead:
https://graph.facebook.com/me/home?access_token=...
Try it on using "Graph API Explorer". /me/home