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

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)

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.

Facebook post impressions are null in FQL stream query

According to the FQL Stream documentation the following query is supposed to return impression counts when run by an authenticated page owner, yet it never does. We have the page owner authenticating directly in the graph api explorer with extended permissions (read_stream, read_insights), but the impression counts are always null.
Is anyone able to get this working?
SELECT post_id, actor_id, message, impressions FROM stream WHERE actor_id = {owned_page} and source_id = {owned_page}
I think its missing in the documentation, but you should make this call using the page access token instead of user access token to get it worked.
So here are the steps:
Get the following permissions from the user and get the user access_token:
manage_pages - to get the page access token
read_insights - to read the impressions (as mentioned in the doc)
read_stream - for all posts that the current session user is able to view
Using that token, get the page access_token with the call-
/{page-id}?fields=access_token
(optional) Check out my answer here to extend this page access token that will never expire. (Basically to avoid some steps)
Using the page access token, run your query-
SELECT post_id, actor_id, message, impressions FROM stream WHERE actor_id = {owned_page} and source_id = {owned_page}
This will fetch you the impressions(if any) in the result.
Hope that helps.!

query event_member table by uid

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.

FQL Error: requires extended permission: read_stream

Today I started get some strange FQL Error.
FQL query: *SELECT target_id FROM connection WHERE source_id = user_id1 AND target_id = user_id2*
*SELECT uid FROM user WHERE has_added_app=1 and uid IN (SELECT uid2 FROM friend WHERE uid1 = "user_id")*
FQL Response (Error): Error: Requires extended permission: read_stream
What is it???
Help.
According to their Change Log, on 2011-09-18, Facebook pushed this update:
FQL connection table now requires read_stream permission. (rE435878)
I had the same problem. I was only using the connection table to get a list of friends, so I was able to change to the friend table to pull the info I needed.
Stuff like this is what makes Facebook Platform a hostile development environment.
Looks like facebook has changed some of the required permissions for some actions this night. The same happened to me. You need to ask for read_stream permissions. For more information refer here
P.S: You might need to remove the application from your profile and add it again with the new permissions

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.