target_id always null - facebook-fql

I'm developing an app to show the user news feeds, everything is fine, except for the "target_id" var, it's returning always a null value.
When I test the first query on http://developers.facebook.com/docs/reference/fql/stream/ and add the "target_id" var to the query, It return the values correctly, but when I run the same query with an access_token of my app, always return null for "target_id"
I suspect this may be a problem with the permission, but I added all the permissions to my app and the problem persists. Any help whith this?. Thanks

Related

Get friends of a User using Facebook API

I am facing a problem in fetching the friends of a user. The following code is working fine when "me" is passed as an UID. But it doesn't work when a user id is passed like 523621551. Every thing is set in the permissions. And i get the "Unsupported operation" error. Following is the code.
public function getAllFriends($uid) {
return $this->fb->api("/" . $uid . "/friends", 'GET', array(
'access_token' => $this->fb->getAccessToken())
);
}
So, what is causing this problem?
I also studied other related questions but those didn't help. :(
You can´t get the friends of ANY user, you can only get the friends of the user who is authorized at the moment. The docs are a bit misleading, it may only work with the (app scoped) user id of the authorized user, but it will never work with any other user id - that request is "unsupported" ;)
Also, you can only get the users who authorized the same App too, just in case you don´t know yet. See changelog: https://developers.facebook.com/docs/apps/changelog
Edit: I just tested it with an App Scoped ID in the API Explorer and it works, so i assume you are trying to get the friends of another user as i expected - which is not supported, of course.
I also tested it with the "real" ID of the authorized user and got the following error:
The global ID 1603196280 is not allowed. Please use the application
specific ID instead.
Makes sense, you would not get the global ID in the App anyway, only App Scoped IDs. As i said, the error you get is not very clear but correct: Getting the friends of ANY user is "unsupported".

Facebook API Friend Location object being returned with empty string for id and null for name

Yesterday, when I retrieved my Facebook Friends from the Graph API using the query "me/friends?fields=id,location" 500+ came back with location data.
Today, 500+ are returned with the location object, but only 36 have any data in the location object, the rest are returned as:
"location": {
"id": "",
"name": null
}
You can reproduce it yourself in the Graph API Explorer. You'll see that some friends have legitimate locations, but the majority have the null values. Does anyone have any idea what's going on? This happened to happen the same day Graph Search was announced. Is it related? How do I fix this?
UPDATE: Facebook has updated the status of the bug that I posted to "Fix Ready" so this should be resolved shortly... https://developers.facebook.com/bugs/487611667944115
As Zachary mentions, it is probably a facebook bug. However they marked the bug as 'medium' priority and could take forever to fix. If you need to get yourself up and running quickly again, switch to an FQL call instead. The following correctly returns location data for all your friends:
SELECT name, uid, current_location FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me())
If you're also looking for hometown info, though, then tough luck. Seems like the bug mentioned also affects FQL in this case...

A specific Fan Page ID is not returning FB Graph data

We are working with High Times Magazine (http://www.facebook.com/HIGHTIMESMag, profile id: 23237898444). I've tried checking via FB's graph to see if the proper data returns, and it doesn't for some reason. You can check here as well:
https://graph.facebook.com/23237898444 and http://graph.facebook.com/HIGHTIMESMag
Does anyone else have this issue? How can I get the id to work, or is this a Facebook bug?
Accessing it with a valid access token (i.e. https://graph.facebook.com/23237898444?access_token=...) works for me. This usually means the page is age- or locale-gated.

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.

insight using fql for facebook application

I tried the below query
SELECT metric, value FROM insights WHERE object_id=3232322 AND
metric='application_active_users' AND end_time=end_time_date('2011-12-12') AND
period=period('day')
I've got read_insights permissions,object_id,i'm passing the page id.
This insights,i create as an facebook app ,to this i'm passing the app access token.
I get an empty array as output.Am,i missing some thing?
I don't think it is an authentication issue because it would return an error (authentication error)
This might be a known issue with end_time; check bug already reported to facebook. I have posted a work around there too that works.
http://developers.facebook.com/bugs/232510993491615?browse=search_4f08c675cce9d2265724293