I'm using play framework to create a facebook application. I'm kinda stucked at some point. With Graph Api i can't take a list of friends who use my application. What i want to say is for example:
A is using my application.
B is using my application too and B is a friend of A.
When A is using my application, I want A to see B is also using this application.
Simply I want to get list of friends using same application.
How would i do that with Graph Api?
There is a field called "is_app_user" on the user table that you could run a FQL query against. The query would be something like:
select uid, name
from user
where is_app_user = 1
and uid in (SELECT uid2 FROM friend WHERE uid1 = me())
The graph url for that would be like this (remember to add an access token):
https://api.facebook.com/method/fql.query?query=select uid, name from user where is_app_user = 1 and uid in (SELECT uid2 FROM friend WHERE uid1 = me())&access_token=...
With Friend A's access token do a Post to me/friends to get the list of friends. See if Friend B is on the list. See: http://developers.facebook.com/docs/reference/api/user/
Related
I have a few Facebook apps, and I use the following FQL to get the list of app users:
SELECT uid,name FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1
and it works fine, but now I created a new app, and the above FQL always returns empty and I know for a fact that I have friends using the APP,
Any ideas?
The problem was solved by adding "user_friends" to the list of requested permissions, I didn't need this permission in Graph API V1.0
I am building a website with venues (for exaple cinemas) and i need to show to the user (user logged in with facebook) his/her friends that have checked in to this place.
I am using long, lat for my places. I am thinking of using a query that will bring the check ins from user;s friends, that are specified by a location center and a distance:
https://graph.facebook.com/search?type=location¢er=38.01166,23.69272&distance=30&access_token=AAAAAAITEghMBAOL5MyxLDoFpRlirSFmEYYGZB7tHd8BH8YsUOW03uX4ewz6lVVPFWudujS0RZC7HdXm2r7OfVvnEgSr3KqRw4Q5WqlEeCNYm07XxyO
Is the query right? Is there any better way? How am i going to show to the venue page on my website, the users' profile pics?
What i realy need to create is something like this!(from tripbirds.com)
but i only want to show their photo not their post on that place.
http://imageshack.us/photo/my-images/13/22811412.png/
Since each place has its own page_id, you can use the checkin table and friend table to construct a query like -
select author_uid from checkin where page_id = [PLACEID_WHERE_CHECKEDIN] and author_uid in (select uid2 from friend where uid1 = me())
And once you have the friends' id, it's simple to get their info and profile pic from the user table. If you really wanted to do it in 1 query, you could enclose the above in a query like -
select pic_square from user where uid in (ABOVE-QUERY)
I have a FB app. I need to have a functionality similar to which is present on Washington post reader that shows friends on the app.
Is it FB facepile? If so, then how have they implemented to show more than 4 friends with a button? Have they implemented it server side ?
You can use FQL to retrieve friends using the same app.
Simply use the query below and you should be able to get frineds' uid, name and is_app_user.
*is_app_user* indicates if a given user is using your app or not.
select uid, name, is_app_user from user where uid in (select uid2 from
friend where uid1=me()) and is_app_user=1
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'.
I've been playing around the Facebook Graph API for a while now.
I'm trying to get the list of friends using https://graph.facebook.com/me/friends.
While it's working fine, the results are ordered by Id. Is there a way to get them ordered by name, or do I have to reorder them manually via my application layer?
Thanks!
I don't think there is a way of ordering Graph API results, but you can order FQL results. Something like:
SELECT name, uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = $current_user_id) ORDER BY name