query event_member table by uid - facebook

When I run this simple query:
SELECT eid FROM event_member WHERE uid = MY_FRIEND_UID
in the test query console, I always get back an empty result set.However, if I replace MY_FRIEND_ID with me(), I get back my list of events.
My app is set to allow user_events and friends_events, so here is my question:
Is it possible to query the event_member by uid, given the uid is one of my friends?
if yes, why this query is not working?

I had similar problem. I turned out that the access token that I was using did not had the new permissions (exactly the same user_events and friends_events) because it was obtained before adding those permission to the app.
You can try to use use Facebook Graph API Explorer to Debug the permission of your currently used token and to easily generate a new token and run the HQL with it. In my case it turned out immediately that the problem was in the token permission and with new token everything worked like a charm.

Related

Finding a users friends and determining if they have the app

So, after looking around the two solutions ive seen are:
1) Using the graph API
me/friends?fields=installed
2) Using FQL
SELECT uid FROM user WHERE uid in (SELECT uid1 FROM friend WHERE uid2=me()) AND is_app_user
SELECT uid FROM user WHERE uid in (SELECT uid1 FROM friend WHERE uid2=me()) AND NOT is_app_user
Using the graph API i'm always met with permissions issues and cannot find what permission i need to request in order to access it. And the FQL solution seems to always return false.
So I'm left wondering if theres something simple that im missing in order to get this working,or whether or not these methods are outdated and theres a better way.
Thanks in advance
EDIT 1
I should mention that i am working from a C# api
Using PHP SDK you can get the friendlist by using:
$facebook->api(array('method' => 'friends.getAppUsers'));
As for the permissions: You need to have the email permission to get the friends list with installed flag in it.
I can guess that you are following the normal login flow. like,
1)opening session
2)requesting read permissions (user_info etc.)
just add the "email" permission in read permissions as well and you shall get this installed flag.
3) and then you can use either the graph api or FQL, results should be similar.

FQL - can't get link info from user - 'Request Failed' error

This should be an easy one. All I want it the user's profile url.
I've tried the following FQL:
SELECT profile_url FROM standard_user_info WHERE uid = me()
but get the Request Failed error. I'm using the Graph API Explorer / FQL Query and have the latest Access Token.
Basically I'm looking for the FQL equivalent to this Graph API call:
https://graph.facebook.com/me?fields=link
Thanks for the help
If you read the documentation properly, you'll notice that-
standard_user_info requires the APP_ACCESS_TOKEN, instead of USER_ACCESS_TOKEN. You can get the App Access Token from the Access Token Tool, for the testing.
You can get the information about the authorized app users only.
So, you can test it like this-
SELECT profile_url FROM standard_user_info WHERE uid = USER_ID
Note: Don't use me() (since you are using the app access token now which didn't recognize me()), instead use you ID)

facebook api - list user identificators I invited to an event

I'm writting application for facebook using canvas using facebook php api.
My problem: is it possible (and if yes - how) to get from api list of users i (or user who gave me permision using AccessToken) invited to an event?
When i list event_members table using FQL i dont get inviter nor inviter_type informations...
SELECT inviter,inviter_type,rsvp_status,uid FROM event_member WHERE eid = someeventid
That query ends with those fields empty - and from what i read thats expected behaviour becouse its private date - who invited who.

Why won't this events FQL statement return results?

I'm trying to return events for a specific account. This a query that used to work but one morning decided not to. Pasting it into facebook's query console, I get all of the results but on my actual site it returns an empty array. Why?
SELECT
eid, name, pic, start_time, end_time, location, description
FROM
event
WHERE
eid
IN ( SELECT
eid
FROM
event_member
WHERE
uid = 256179217727449 )
AND
start_time > 1326725270
ORDER BY
start_time asc
There's a few reasons why this query would stop working.
The access token is expired
Your facebook app is disabled
Your event is gone
The uid is no longer active
Your access token is not setup for user_events
The start time has changed to before the time code specified
The uid is no longer a facebook user
My suggestion, try your FQL using the Graph API Explorer at: https://developers.facebook.com/tools/explorer and add to your question the results it returns.

How to get facebooks friends who are all single using either PHP sdk or FQL?

In my application I'm trying out to list only the friends who are all single.
I tried different methods and it didn't return proper values...
I tried the graph API but could list only all the friends irrespective of their relationship status.
i tried $facebook->api("/$user/friends?relationship_status='single'");
Also i tried to use FQL and fetch things up but the relationship status always return up as 'null' for even the user who have approved the applications and gave permission to access their relationship_status..
the fql query i tried is
SELECT
uid,name, relationship_status, current_location
FROM user
WHERE
uid IN (SELECT uid2 FROM friend WHERE uid1 = 2343434434234)
How can i get this done?
The problem is that you're only asking for that user's relationship status. You need to also ask for the friends_relationships permission. Once you do that, your query will work fine.