I'm trying to query the date of the last wallpost for each of my friends using FQL.
I've tried something like this:
SELECT post_id, created_time FROM stream WHERE source_id IN (SELECT uid2 FROM friend WHERE uid1 = me())
However, this does not provide me with the output I am looking for. Furthermore I wonder how to set the LIMIT?
Thank you for your help!
If you have an v1.0 app, you could use
SELECT post_id, created_time FROM stream WHERE source_id IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by created_time desc limit 1
If you have a v2.0 app, you'll only see the posts of the friend which are using the same app. If you're using >v2.0 then you have no chance to use FQL. In general, FQL will be deprecated on August 7th, 2016.
You canĀ“t get the posts of friends anymore, for privacy reasons. Friend permissions are gone: https://developers.facebook.com/docs/apps/changelog
You may want to stop using FQL too, because:
The FQL and REST APIs are no longer available in v2.1
Related
I am using facebook FQL to get the friends list
I am using this query
"select uid, name, pic_square, is_app_user from user where uid in (select uid2 from friend where uid1 = me())";SELECT uid, name, is_app_user, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1"
Its working fine but it returns me only few friends like 15 to 20
I need all my friends in responce
Any idae?
Thanks
I guess you're using v2.0 of the Graph API. Therefore, you only get the friends which also use the app of which the requesting user access token was issued
See https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
If your app was set up before April 30th 2014, you can specify that you explicitly want to use v1.0, which will give you all friends. This will only work until April 30th, 2015. If the app was created later, there's no possibility to get all friends.
Is it possible that I can get ALL the posts from my friends via API in facebook? I mean All because I need all of them to search if it contains a keywork. Is it possible?
You can search an individual user's News Feed, restricted to that user's friends, by adding a q argument to the home connection URL:
News Feed: https://graph.facebook.com/me/home?q={KEY}
https://graph.facebook.com/me/home?q={QUERY}&access_token={ACCESS_TOKEN}
Eg: https://graph.facebook.com/me/home?q=facebook&access_token=######
You can do that by using the following FQL query:
SELECT post_id, message FROM stream WHERE source_id IN
(SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT 5000
But you need a valid Access Token with an extended read_stream permission. For testing your FQL queries, you can use Graph API Explorer.
As we can get feeds of specific user or fan page, I wanted to know that how can I get feeds from specific Hashtag like in twitter by fql or Graph API ?
I am using Facebook SDK 3.5.2
Thanks.
As far as I can tell, searching specific posts by hashtags is currently unavailable.
You can still find posts regarding a #hashtag querying a user's stream for a specific message:
SELECT message
FROM stream
WHERE
(source_id IN (SELECT uid2 FROM friend WHERE uid1 = me()) OR source_id=me() )
AND strpos(lower(message),lower('#hashtag')) >=0
Is there a way to get friends with relationship_status equals Married using Graph API?
I did it using FQL, but some fields aren't equals and I have problems using RestFB with these fields like birthday which have different behaviors using Graph API and FQL.
FQL code do get married friends
SELECT uid, name, relationship_status FROM user WHERE (uid = MY_ID OR uid IN (SELECT uid2 FROM friend WHERE uid1 = MY_ID)) AND relationship_status='Married'
I wanna to do the same with Graph API
Graph API is more clean I think too.
Thanks
You have the exact query to get all married friends.
Just you have to do is call this FQL query using GRAPH API.
See the following blog for more details on how to call an FQL using GRAPH API.
http://developers.facebook.com/blog/post/579/
Also please read my answer to this question to just to fix any possible errors when using 'file_get_contents' in your code (as in the example of the FB blog post)
try this..
https://graph.facebook.com/fql?q=SELECT uid, name, relationship_status FROM user WHERE (uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())) AND relationship_status='Married'.
Is there any fql statements allowed by facebook that helps to fetch contents of this page through an application interface: http://www.facebook.com/posted.php I know the links table returns the posted item for a logged in user (http://developers.facebook.com/docs/reference/fql/links). I need the same but for the logged-in user's friends.
Thanks.
you can use Fql query or Graph API to get your friends data.
Sometimes you will not get all information from the graph like birthdate of your friends but yes you can use fql queries to solve your probs.
here is an exmple for you.
create first facbook object and the use it.
$query = "SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 0 ORDER BY birthday_date";
Regards,
Archit.
You can do this through an FQL query - though you may need to use multiple queries if you require more information about the friend who posted the link:
select title, owner from link where owner in (select uid2 from friend where uid1 = me() limit 100)
You may want to limit the number of friends (or even the links themselves) as this can be a costly query